Reading datasets: railroad_2012_clean_county, birds, wild_birds_data

hw1
challenge1
Susmita Madineni
railroad_2012_clean_county, birds, wild bird_data
readr, readxl
Author

Susmita Madineni

Published

February 20, 2022

Code
library(tidyverse)

knitr::opts_chunk$set(echo = TRUE)

Describing the railroad_2012_clean_county data

This dataset gives the information about rail roads in different states, along with total number of employees and county information in the year 2012. It has mainly 3 columns - “state”, “county”, “total_employees”. The dataset has 2930 rows and 3 columns.The reader can easily understand the data by looking at the first few rows.

Code
# Reading railroad_2012_clean_county.csv dataset

library(readr)
railroad <- read_csv("_data/railroad_2012_clean_county.csv")
Rows: 2930 Columns: 3
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (2): state, county
dbl (1): total_employees

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Code
view(railroad)
# Preview the first few rows of the dataset
head(railroad)
# A tibble: 6 × 3
  state county               total_employees
  <chr> <chr>                          <dbl>
1 AE    APO                                2
2 AK    ANCHORAGE                          7
3 AK    FAIRBANKS NORTH STAR               2
4 AK    JUNEAU                             3
5 AK    MATANUSKA-SUSITNA                  2
6 AK    SITKA                              1
Code
# Understanding the dimensions of the dataset 
dim(railroad)
[1] 2930    3
Code
# Identifying the column names of the dataset 
colnames(railroad)
[1] "state"           "county"          "total_employees"
Code
#Making a proportional table for state in the dataset
prop.table(table(select(railroad, state)))
state
          AE           AK           AL           AP           AR           AZ 
0.0003412969 0.0020477816 0.0228668942 0.0003412969 0.0245733788 0.0051194539 
          CA           CO           CT           DC           DE           FL 
0.0187713311 0.0194539249 0.0027303754 0.0003412969 0.0010238908 0.0228668942 
          GA           HI           IA           ID           IL           IN 
0.0518771331 0.0010238908 0.0337883959 0.0122866894 0.0351535836 0.0313993174 
          KS           KY           LA           MA           MD           ME 
0.0324232082 0.0406143345 0.0215017065 0.0040955631 0.0081911263 0.0054607509 
          MI           MN           MO           MS           MT           NC 
0.0266211604 0.0293515358 0.0392491468 0.0266211604 0.0180887372 0.0320819113 
          ND           NE           NH           NJ           NM           NV 
0.0167235495 0.0303754266 0.0034129693 0.0071672355 0.0098976109 0.0040955631 
          NY           OH           OK           OR           PA           RI 
0.0208191126 0.0300341297 0.0249146758 0.0112627986 0.0221843003 0.0017064846 
          SC           SD           TN           TX           UT           VA 
0.0156996587 0.0177474403 0.0310580205 0.0754266212 0.0085324232 0.0313993174 
          VT           WA           WI           WV           WY 
0.0047781570 0.0133105802 0.0235494881 0.0180887372 0.0075085324 
Code
#Filter county APO from the dataset 
filter(railroad, county == "APO")
# A tibble: 2 × 3
  state county total_employees
  <chr> <chr>            <dbl>
1 AE    APO                  2
2 AP    APO                  1
Code
#Filter the rows that has total_employees below 3 and above 100
filter(railroad, `total_employees` < 3 | `total_employees` > 100)
# A tibble: 809 × 3
   state county               total_employees
   <chr> <chr>                          <dbl>
 1 AE    APO                                2
 2 AK    FAIRBANKS NORTH STAR               2
 3 AK    MATANUSKA-SUSITNA                  2
 4 AK    SITKA                              1
 5 AL    AUTAUGA                          102
 6 AL    BALDWIN                          143
 7 AL    BARBOUR                            1
 8 AL    BLOUNT                           154
 9 AL    COLBERT                          199
10 AL    CULLMAN                          129
# … with 799 more rows
Code
#Arranging railroad based on total_employees and selecting state, county columns,grouping them based on state and then slicing out first 10 rows (with piping)
railroad %>%
  arrange(desc(total_employees)) %>%
  select(state,county)%>%
  group_by(state) %>%
  slice(1:10)
# A tibble: 478 × 2
# Groups:   state [53]
   state county              
   <chr> <chr>               
 1 AE    APO                 
 2 AK    SKAGWAY MUNICIPALITY
 3 AK    ANCHORAGE           
 4 AK    JUNEAU              
 5 AK    FAIRBANKS NORTH STAR
 6 AK    MATANUSKA-SUSITNA   
 7 AK    SITKA               
 8 AL    JEFFERSON           
 9 AL    MOBILE              
10 AL    COLBERT             
# … with 468 more rows

Describing the birds dataset

This dataset gives the information about value of 1000 heads of the birds like chicken, ducks, turkeys,etc in different countries across the world in different years(from 1961 to 2018). It has 14 columns - “Domain Code”, “Domain”, “Area Code”, “Area”, “Element Code”, “Element”,“Item Code”, “Item”,“Year Code”, “Year”, “Unit”, “Value”, “Flag”, “Flag Description”. The dataset has 30977 rows and 14 columns.The reader can understand the data by looking at the first few rows.

Code
# Reading birds.csv dataset

library(readr)
birds_data <- read_csv("_data/birds.csv")
Rows: 30977 Columns: 14
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (8): Domain Code, Domain, Area, Element, Item, Unit, Flag, Flag Description
dbl (6): Area Code, Element Code, Item Code, Year Code, Year, Value

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Code
view(birds_data)
# Preview the first few rows of the dataset
head(birds_data)
# A tibble: 6 × 14
  Domai…¹ Domain Area …² Area  Eleme…³ Element Item …⁴ Item  Year …⁵  Year Unit 
  <chr>   <chr>    <dbl> <chr>   <dbl> <chr>     <dbl> <chr>   <dbl> <dbl> <chr>
1 QA      Live …       2 Afgh…    5112 Stocks     1057 Chic…    1961  1961 1000…
2 QA      Live …       2 Afgh…    5112 Stocks     1057 Chic…    1962  1962 1000…
3 QA      Live …       2 Afgh…    5112 Stocks     1057 Chic…    1963  1963 1000…
4 QA      Live …       2 Afgh…    5112 Stocks     1057 Chic…    1964  1964 1000…
5 QA      Live …       2 Afgh…    5112 Stocks     1057 Chic…    1965  1965 1000…
6 QA      Live …       2 Afgh…    5112 Stocks     1057 Chic…    1966  1966 1000…
# … with 3 more variables: Value <dbl>, Flag <chr>, `Flag Description` <chr>,
#   and abbreviated variable names ¹​`Domain Code`, ²​`Area Code`,
#   ³​`Element Code`, ⁴​`Item Code`, ⁵​`Year Code`
Code
# Understanding the dimensions of the dataset 
dim(birds_data)
[1] 30977    14
Code
# Identifying the column names of the dataset 
colnames(birds_data)
 [1] "Domain Code"      "Domain"           "Area Code"        "Area"            
 [5] "Element Code"     "Element"          "Item Code"        "Item"            
 [9] "Year Code"        "Year"             "Unit"             "Value"           
[13] "Flag"             "Flag Description"
Code
#Making a proportional table for state in the dataset
prop.table(table(select(birds_data, Area)))
Area
                                         Afghanistan 
                                        0.0018723569 
                                              Africa 
                                        0.0093617845 
                                             Albania 
                                        0.0074894276 
                                             Algeria 
                                        0.0074894276 
                                      American Samoa 
                                        0.0018723569 
                                            Americas 
                                        0.0074894276 
                                              Angola 
                                        0.0018723569 
                                 Antigua and Barbuda 
                                        0.0018723569 
                                           Argentina 
                                        0.0074894276 
                                             Armenia 
                                        0.0017432288 
                                               Aruba 
                                        0.0009361785 
                                                Asia 
                                        0.0093617845 
                                           Australia 
                                        0.0056170707 
                           Australia and New Zealand 
                                        0.0074894276 
                                             Austria 
                                        0.0074894276 
                                          Azerbaijan 
                                        0.0017432288 
                                             Bahamas 
                                        0.0018723569 
                                             Bahrain 
                                        0.0018723569 
                                          Bangladesh 
                                        0.0037447138 
                                            Barbados 
                                        0.0037447138 
                                             Belarus 
                                        0.0026148433 
                                             Belgium 
                                        0.0024534332 
                                  Belgium-Luxembourg 
                                        0.0050359944 
                                              Belize 
                                        0.0056170707 
                                               Benin 
                                        0.0018723569 
                                             Bermuda 
                                        0.0035510217 
                                              Bhutan 
                                        0.0018723569 
                    Bolivia (Plurinational State of) 
                                        0.0056170707 
                              Bosnia and Herzegovina 
                                        0.0034864577 
                                            Botswana 
                                        0.0018723569 
                                              Brazil 
                                        0.0056170707 
                                   Brunei Darussalam 
                                        0.0037447138 
                                            Bulgaria 
                                        0.0074894276 
                                        Burkina Faso 
                                        0.0018723569 
                                             Burundi 
                                        0.0027762533 
                                          Cabo Verde 
                                        0.0018723569 
                                            Cambodia 
                                        0.0037447138 
                                            Cameroon 
                                        0.0018723569 
                                              Canada 
                                        0.0074894276 
                                           Caribbean 
                                        0.0074894276 
                                      Cayman Islands 
                                        0.0017109468 
                            Central African Republic 
                                        0.0037447138 
                                     Central America 
                                        0.0056170707 
                                        Central Asia 
                                        0.0034864577 
                                                Chad 
                                        0.0018723569 
                                               Chile 
                                        0.0037447138 
                                China, Hong Kong SAR 
                                        0.0090066824 
                                    China, Macao SAR 
                                        0.0018723569 
                                     China, mainland 
                                        0.0056170707 
                           China, Taiwan Province of 
                                        0.0074894276 
                                            Colombia 
                                        0.0018723569 
                                             Comoros 
                                        0.0018723569 
                                               Congo 
                                        0.0018723569 
                                        Cook Islands 
                                        0.0035187397 
                                          Costa Rica 
                                        0.0018723569 
                                       Côte d'Ivoire 
                                        0.0027762533 
                                             Croatia 
                                        0.0034864577 
                                                Cuba 
                                        0.0018723569 
                                              Cyprus 
                                        0.0089421183 
                                             Czechia 
                                        0.0033573296 
                                      Czechoslovakia 
                                        0.0041320980 
               Democratic People's Republic of Korea 
                                        0.0037447138 
                    Democratic Republic of the Congo 
                                        0.0018723569 
                                             Denmark 
                                        0.0074894276 
                                            Dominica 
                                        0.0018723569 
                                  Dominican Republic 
                                        0.0018723569 
                                      Eastern Africa 
                                        0.0074894276 
                                        Eastern Asia 
                                        0.0093617845 
                                      Eastern Europe 
                                        0.0074894276 
                                             Ecuador 
                                        0.0074894276 
                                               Egypt 
                                        0.0093617845 
                                         El Salvador 
                                        0.0018723569 
                                   Equatorial Guinea 
                                        0.0037447138 
                                             Eritrea 
                                        0.0008393324 
                                             Estonia 
                                        0.0034864577 
                                            Eswatini 
                                        0.0018723569 
                                            Ethiopia 
                                        0.0008393324 
                                        Ethiopia PDR 
                                        0.0010330245 
                                              Europe 
                                        0.0093617845 
                         Falkland Islands (Malvinas) 
                                        0.0018723569 
                                                Fiji 
                                        0.0056170707 
                                             Finland 
                                        0.0053588146 
                                              France 
                                        0.0093617845 
                                       French Guyana 
                                        0.0037447138 
                                    French Polynesia 
                                        0.0037447138 
                                               Gabon 
                                        0.0018723569 
                                              Gambia 
                                        0.0018723569 
                                             Georgia 
                                        0.0017432288 
                                             Germany 
                                        0.0074894276 
                                               Ghana 
                                        0.0018723569 
                                              Greece 
                                        0.0093617845 
                                             Grenada 
                                        0.0018723569 
                                          Guadeloupe 
                                        0.0049714304 
                                                Guam 
                                        0.0018723569 
                                           Guatemala 
                                        0.0018723569 
                                              Guinea 
                                        0.0018723569 
                                       Guinea-Bissau 
                                        0.0018723569 
                                              Guyana 
                                        0.0018723569 
                                               Haiti 
                                        0.0074894276 
                                            Honduras 
                                        0.0018723569 
                                             Hungary 
                                        0.0074894276 
                                             Iceland 
                                        0.0018723569 
                                               India 
                                        0.0037447138 
                                           Indonesia 
                                        0.0037447138 
                          Iran (Islamic Republic of) 
                                        0.0074894276 
                                                Iraq 
                                        0.0018723569 
                                             Ireland 
                                        0.0074894276 
                                              Israel 
                                        0.0068437873 
                                               Italy 
                                        0.0037447138 
                                             Jamaica 
                                        0.0018723569 
                                               Japan 
                                        0.0037447138 
                                              Jordan 
                                        0.0080059399 
                                          Kazakhstan 
                                        0.0017432288 
                                               Kenya 
                                        0.0018723569 
                                            Kiribati 
                                        0.0018723569 
                                              Kuwait 
                                        0.0018723569 
                                          Kyrgyzstan 
                                        0.0034864577 
                    Lao People's Democratic Republic 
                                        0.0056170707 
                                              Latvia 
                                        0.0017432288 
                                             Lebanon 
                                        0.0029699454 
                                             Lesotho 
                                        0.0018723569 
                                             Liberia 
                                        0.0037447138 
                                               Libya 
                                        0.0018723569 
                                       Liechtenstein 
                                        0.0018723569 
                                           Lithuania 
                                        0.0034864577 
                                          Luxembourg 
                                        0.0006133583 
                                          Madagascar 
                                        0.0074894276 
                                              Malawi 
                                        0.0018723569 
                                            Malaysia 
                                        0.0037447138 
                                                Mali 
                                        0.0018723569 
                                               Malta 
                                        0.0052942506 
                                          Martinique 
                                        0.0051651225 
                                          Mauritania 
                                        0.0018723569 
                                           Mauritius 
                                        0.0074894276 
                                           Melanesia 
                                        0.0056170707 
                                              Mexico 
                                        0.0056170707 
                                          Micronesia 
                                        0.0037447138 
                    Micronesia (Federated States of) 
                                        0.0018077929 
                                       Middle Africa 
                                        0.0056170707 
                                            Mongolia 
                                        0.0018723569 
                                          Montenegro 
                                        0.0004196662 
                                          Montserrat 
                                        0.0018723569 
                                             Morocco 
                                        0.0037447138 
                                          Mozambique 
                                        0.0074894276 
                                             Myanmar 
                                        0.0093617845 
                                             Namibia 
                                        0.0037447138 
                                               Nauru 
                                        0.0018723569 
                                               Nepal 
                                        0.0037447138 
                                         Netherlands 
                                        0.0053588146 
                       Netherlands Antilles (former) 
                                        0.0018723569 
                                       New Caledonia 
                                        0.0018723569 
                                         New Zealand 
                                        0.0074894276 
                                           Nicaragua 
                                        0.0018723569 
                                               Niger 
                                        0.0018723569 
                                             Nigeria 
                                        0.0018723569 
                                                Niue 
                                        0.0018723569 
                                     North Macedonia 
                                        0.0008716144 
                                     Northern Africa 
                                        0.0093617845 
                                    Northern America 
                                        0.0074894276 
                                     Northern Europe 
                                        0.0074894276 
                                              Norway 
                                        0.0056170707 
                                             Oceania 
                                        0.0074894276 
                                                Oman 
                                        0.0027762533 
                     Pacific Islands Trust Territory 
                                        0.0019369209 
                                            Pakistan 
                                        0.0037447138 
                                           Palestine 
                                        0.0018723569 
                                              Panama 
                                        0.0056170707 
                                    Papua New Guinea 
                                        0.0056170707 
                                            Paraguay 
                                        0.0074894276 
                                                Peru 
                                        0.0018723569 
                                         Philippines 
                                        0.0074894276 
                                              Poland 
                                        0.0074894276 
                                           Polynesia 
                                        0.0037447138 
                                            Portugal 
                                        0.0042289441 
                                         Puerto Rico 
                                        0.0018723569 
                                               Qatar 
                                        0.0018723569 
                                   Republic of Korea 
                                        0.0073602996 
                                 Republic of Moldova 
                                        0.0017432288 
                                             Réunion 
                                        0.0050682765 
                                             Romania 
                                        0.0074894276 
                                  Russian Federation 
                                        0.0034864577 
                                              Rwanda 
                                        0.0041320980 
        Saint Helena, Ascension and Tristan da Cunha 
                                        0.0018723569 
                               Saint Kitts and Nevis 
                                        0.0018723569 
                                         Saint Lucia 
                                        0.0018723569 
                           Saint Pierre and Miquelon 
                                        0.0029699454 
                    Saint Vincent and the Grenadines 
                                        0.0018723569 
                                               Samoa 
                                        0.0018723569 
                               Sao Tome and Principe 
                                        0.0056170707 
                                        Saudi Arabia 
                                        0.0028730994 
                                             Senegal 
                                        0.0018723569 
                                              Serbia 
                                        0.0016786648 
                               Serbia and Montenegro 
                                        0.0018077929 
                                          Seychelles 
                                        0.0037447138 
                                        Sierra Leone 
                                        0.0037447138 
                                           Singapore 
                                        0.0037447138 
                                            Slovakia 
                                        0.0033573296 
                                            Slovenia 
                                        0.0034864577 
                                     Solomon Islands 
                                        0.0018723569 
                                             Somalia 
                                        0.0018723569 
                                  South-eastern Asia 
                                        0.0093617845 
                                        South Africa 
                                        0.0074894276 
                                       South America 
                                        0.0074894276 
                                         South Sudan 
                                        0.0002259741 
                                     Southern Africa 
                                        0.0093617845 
                                       Southern Asia 
                                        0.0074894276 
                                     Southern Europe 
                                        0.0093617845 
                                               Spain 
                                        0.0056816348 
                                           Sri Lanka 
                                        0.0037447138 
                                               Sudan 
                                        0.0002259741 
                                      Sudan (former) 
                                        0.0016463828 
                                            Suriname 
                                        0.0037447138 
                                              Sweden 
                                        0.0037447138 
                                         Switzerland 
                                        0.0074894276 
                                Syrian Arab Republic 
                                        0.0093617845 
                                          Tajikistan 
                                        0.0008716144 
                                            Thailand 
                                        0.0056170707 
                                         Timor-Leste 
                                        0.0018723569 
                                                Togo 
                                        0.0018723569 
                                             Tokelau 
                                        0.0018723569 
                                               Tonga 
                                        0.0018723569 
                                 Trinidad and Tobago 
                                        0.0018723569 
                                             Tunisia 
                                        0.0030022275 
                                              Turkey 
                                        0.0074894276 
                                        Turkmenistan 
                                        0.0017432288 
                                              Tuvalu 
                                        0.0018723569 
                                              Uganda 
                                        0.0018723569 
                                             Ukraine 
                                        0.0034864577 
                                United Arab Emirates 
                                        0.0018723569 
United Kingdom of Great Britain and Northern Ireland 
                                        0.0074894276 
                         United Republic of Tanzania 
                                        0.0037447138 
                            United States of America 
                                        0.0056170707 
                        United States Virgin Islands 
                                        0.0018723569 
                                             Uruguay 
                                        0.0074894276 
                                                USSR 
                                        0.0020014850 
                                          Uzbekistan 
                                        0.0017432288 
                                             Vanuatu 
                                        0.0018723569 
                  Venezuela (Bolivarian Republic of) 
                                        0.0018723569 
                                            Viet Nam 
                                        0.0037447138 
                           Wallis and Futuna Islands 
                                        0.0018723569 
                                      Western Africa 
                                        0.0037447138 
                                        Western Asia 
                                        0.0093617845 
                                      Western Europe 
                                        0.0093617845 
                                               World 
                                        0.0093617845 
                                               Yemen 
                                        0.0018723569 
                                        Yugoslav SFR 
                                        0.0040029699 
                                              Zambia 
                                        0.0018723569 
                                            Zimbabwe 
                                        0.0056170707 
Code
#Filter Area Code = 3 from the dataset 
filter(birds_data, `Area Code` == 3)
# A tibble: 232 × 14
   Domain Cod…¹ Domain Area …² Area  Eleme…³ Element Item …⁴ Item  Year …⁵  Year
   <chr>        <chr>    <dbl> <chr>   <dbl> <chr>     <dbl> <chr>   <dbl> <dbl>
 1 QA           Live …       3 Alba…    5112 Stocks     1057 Chic…    1961  1961
 2 QA           Live …       3 Alba…    5112 Stocks     1057 Chic…    1962  1962
 3 QA           Live …       3 Alba…    5112 Stocks     1057 Chic…    1963  1963
 4 QA           Live …       3 Alba…    5112 Stocks     1057 Chic…    1964  1964
 5 QA           Live …       3 Alba…    5112 Stocks     1057 Chic…    1965  1965
 6 QA           Live …       3 Alba…    5112 Stocks     1057 Chic…    1966  1966
 7 QA           Live …       3 Alba…    5112 Stocks     1057 Chic…    1967  1967
 8 QA           Live …       3 Alba…    5112 Stocks     1057 Chic…    1968  1968
 9 QA           Live …       3 Alba…    5112 Stocks     1057 Chic…    1969  1969
10 QA           Live …       3 Alba…    5112 Stocks     1057 Chic…    1970  1970
# … with 222 more rows, 4 more variables: Unit <chr>, Value <dbl>, Flag <chr>,
#   `Flag Description` <chr>, and abbreviated variable names ¹​`Domain Code`,
#   ²​`Area Code`, ³​`Element Code`, ⁴​`Item Code`, ⁵​`Year Code`
Code
#Filter the rows that has Item Code as 1057 and Item as Chickens
filter(birds_data, `Item Code` == 1057 & `Item` == "Chickens")
# A tibble: 13,074 × 14
   Domain Cod…¹ Domain Area …² Area  Eleme…³ Element Item …⁴ Item  Year …⁵  Year
   <chr>        <chr>    <dbl> <chr>   <dbl> <chr>     <dbl> <chr>   <dbl> <dbl>
 1 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1961  1961
 2 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1962  1962
 3 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1963  1963
 4 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1964  1964
 5 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1965  1965
 6 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1966  1966
 7 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1967  1967
 8 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1968  1968
 9 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1969  1969
10 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1970  1970
# … with 13,064 more rows, 4 more variables: Unit <chr>, Value <dbl>,
#   Flag <chr>, `Flag Description` <chr>, and abbreviated variable names
#   ¹​`Domain Code`, ²​`Area Code`, ³​`Element Code`, ⁴​`Item Code`, ⁵​`Year Code`
Code
#Arranging data based on Value and selecting Area, Item, Value columns, grouping them based on Area and then slicing out first 10 rows (with piping)
birds_data %>%
  arrange(desc(Value)) %>%
  select(Area, Item, Value)%>%
  group_by(Area) %>%
  slice(1:10)
# A tibble: 2,474 × 3
# Groups:   Area [248]
   Area        Item     Value
   <chr>       <chr>    <dbl>
 1 Afghanistan Chickens 14414
 2 Afghanistan Chickens 14152
 3 Afghanistan Chickens 13573
 4 Afghanistan Chickens 13378
 5 Afghanistan Chickens 13212
 6 Afghanistan Chickens 13022
 7 Afghanistan Chickens 12888
 8 Afghanistan Chickens 12402
 9 Afghanistan Chickens 12156
10 Afghanistan Chickens 12053
# … with 2,464 more rows

Describing the wild_bird_data dataset

This dataset gives the information wet body weight and population size of wild birds. It has 2 columns - “Reference”, “Taken from Figure 1 of Nee et al.”. The dataset has 147 rows and 2 columns.The reader can understand the data by looking at the first few rows.

Code
# Reading wild_bird_data.xlsx dataset

library("readxl")
wild_birds_data <- read_xlsx("_data/wild_bird_data.xlsx")
view(wild_birds_data)
# Preview the first few rows of the dataset
head(wild_birds_data)
# A tibble: 6 × 2
  Reference           `Taken from Figure 1 of Nee et al.`
  <chr>               <chr>                              
1 Wet body weight [g] Population size                    
2 5.45887180052624    532194.395145161                   
3 7.76456810683605    3165107.44544653                   
4 8.63858738018464    2592996.86778979                   
5 10.6897349302105    3524193.2266336                    
6 7.41722577905587    389806.168891807                   
Code
# Understanding the dimensions of the dataset 
dim(wild_birds_data)
[1] 147   2
Code
# Identifying the column names of the dataset 
colnames(wild_birds_data)
[1] "Reference"                         "Taken from Figure 1 of Nee et al."
Code
#Making a proportional table for Reference  in the dataset
prop.table(table(select(wild_birds_data, Reference)))
Reference
   10.0837373583453    10.4227948279533    10.6897349302105    10.9430490453536 
        0.006802721         0.006802721         0.006802721         0.006802721 
   1003.03939853867    1008.19886351951    102.577037919272    103.351145634621 
        0.006802721         0.006802721         0.006802721         0.006802721 
   1042.06074444654    105.251145466066     105.27800534013    1064.32682601983 
        0.006802721         0.006802721         0.006802721         0.006802721 
   11.0657951888437    11.3325639394677    11.7501765156051    11.8338885705264 
        0.006802721         0.006802721         0.006802721         0.006802721 
    11.911899237195    110.993242131064    1106.07510035687    1137.96479906865 
        0.006802721         0.006802721         0.006802721         0.006802721 
   114.163158354383    116.289475709079     12.073867120209    12.9107556641051 
        0.006802721         0.006802721         0.006802721         0.006802721 
   128.395335803439    128.575653541364    13.4190149139047    13.7066181013302 
        0.006802721         0.006802721         0.006802721         0.006802721 
   135.486491343145    1368.36501582366    138.513955740119    14.5348410462378 
        0.006802721         0.006802721         0.006802721         0.006802721 
   14.9327931173702     15.250338580451    15.4756001614342    15.5437260853068 
        0.006802721         0.006802721         0.006802721         0.006802721 
    16.173314711739    16.3353638573666     16.713625723242    16.7374033065426 
        0.006802721         0.006802721         0.006802721         0.006802721 
   16.8480457069965    16.9541655530351    163.276223677476    17.7715823185348 
        0.006802721         0.006802721         0.006802721         0.006802721 
   173.454892979421    175.840624652506    18.4587461659311    18.4717033015697 
        0.006802721         0.006802721         0.006802721         0.006802721 
   18.5902522391181    18.7105850428847    18.7218421193228    19.1013268966518 
        0.006802721         0.006802721         0.006802721         0.006802721 
   19.3930121740443     19.492233639612    194.303351756182    20.4175008347481 
        0.006802721         0.006802721         0.006802721         0.006802721 
    20.556216729787    2053.74863827143    21.2700694334402    212.147017049613 
        0.006802721         0.006802721         0.006802721         0.006802721 
   22.2677519174593    22.3057316395665    22.4321177480063     22.689316708056 
        0.006802721         0.006802721         0.006802721         0.006802721 
   22.7960529394349    221.693442317827    226.218006871375    23.9762697808197 
        0.006802721         0.006802721         0.006802721         0.006802721 
   232.254993447017    2320.09569921356    24.4422047589553     240.78960679855 
        0.006802721         0.006802721         0.006802721         0.006802721 
   25.2824793404366    251.746484961854    251.762544720258    255.963705031502 
        0.006802721         0.006802721         0.006802721         0.006802721 
    263.89604533577    265.463867650509    27.1737255667256    27.6790862634083 
        0.006802721         0.006802721         0.006802721         0.006802721 
   27.8958488030849    275.131029910782    28.6687569833571    282.288057014247 
        0.006802721         0.006802721         0.006802721         0.006802721 
   287.527400278505    293.799587810237    301.332380779176    303.545552195872 
        0.006802721         0.006802721         0.006802721         0.006802721 
   311.918910823616    32.2163205913993    33.6261656866144    345.112605430166 
        0.006802721         0.006802721         0.006802721         0.006802721 
   35.1758377124708    35.4203082644676    352.281226176494    36.9646386454904 
        0.006802721         0.006802721         0.006802721         0.006802721 
   37.5910580962782    371.889868196688    380.296824961942    39.0641452782309 
        0.006802721         0.006802721         0.006802721         0.006802721 
   393.854923117015    394.224786249175    42.8545510609481    4223.72945322751 
        0.006802721         0.006802721         0.006802721         0.006802721 
   428.549354432903    43.1315511306876    44.8797938229394    4450.50815600577 
        0.006802721         0.006802721         0.006802721         0.006802721 
   462.782070038066    47.9477535298889    479.722220970486    480.965400920035 
        0.006802721         0.006802721         0.006802721         0.006802721 
   486.856962904678    49.9139486401791    5.45887180052624     52.312838051431 
        0.006802721         0.006802721         0.006802721         0.006802721 
   527.513423559442    530.357342971806    603.577402390915      64.74167603758 
        0.006802721         0.006802721         0.006802721         0.006802721 
   645.449083461034    66.4645646879698    67.0724165442755    672.284528540897 
        0.006802721         0.006802721         0.006802721         0.006802721 
   684.506509216141    7.41722577905587    7.76456810683605    71.3921665737811 
        0.006802721         0.006802721         0.006802721         0.006802721 
   72.4618812159043    757.205197645473    765.921951081732    79.3893544290883 
        0.006802721         0.006802721         0.006802721         0.006802721 
   798.020716987072    8.03684333000353    8.63858738018464    8.70473119796067 
        0.006802721         0.006802721         0.006802721         0.006802721 
   8.89032317828959    82.8877457373263    820.520151625127     887.34848570896 
        0.006802721         0.006802721         0.006802721         0.006802721 
    9.1169347252776    9.51590845877281    923.172177028805    95.6625004989711 
        0.006802721         0.006802721         0.006802721         0.006802721 
   954.839393219695    9639.84540069595 Wet body weight [g] 
        0.006802721         0.006802721         0.006802721 
Code
#Filter the rows that has Reference > 10 and Reference < 12
filter(wild_birds_data, `Reference` > 10.0 & `Reference` < 12.0)
# A tibble: 22 × 2
   Reference        `Taken from Figure 1 of Nee et al.`
   <chr>            <chr>                              
 1 10.6897349302105 3524193.2266336                    
 2 10.9430490453536 864.665387886239                   
 3 10.0837373583453 74386.4256983317                   
 4 10.4227948279533 131929.739792131                   
 5 11.0657951888437 164390.10921714                    
 6 11.7501765156051 143943.923703849                   
 7 11.911899237195  62266.8051981741                   
 8 11.8338885705264 49948.4692178362                   
 9 11.3325639394677 15.2869871955882                   
10 116.289475709079 32206.460433963                    
# … with 12 more rows
Code
#Arranging data based on Reference and selecting Reference and then slicing out first 10 rows (with piping)
wild_birds_data %>%
  arrange(desc(Reference)) %>%
  select(Reference)%>%
  slice(1:10)
# A tibble: 10 × 1
   Reference          
   <chr>              
 1 Wet body weight [g]
 2 9639.84540069595   
 3 954.839393219695   
 4 95.6625004989711   
 5 923.172177028805   
 6 9.51590845877281   
 7 9.1169347252776    
 8 887.34848570896    
 9 820.520151625127   
10 82.8877457373263