This function will return the full dataset (or a subset based on input parameters) of county-level estimates of fertilizer application quantity. The fertilizer application type includes farm and non-farms. The dataset was primarily cleaned into Tidy data. Details are availalble via <https://cran.r-project.org/web/packages/usfertilizer/vignettes/Introduction.html>
get_data(data, nutrient = NULL, input_type = NULL, farm_type = NULL, years = NULL, counties = NULL, states = NULL, lat_max = NULL, lat_min = NULL, long_max = NULL, long_min = NULL, FIPSs = NULL, overlap_state_county = TRUE, combine_state_county = FALSE)
data | the dataset to work with, generally the full usfertilizer or its subsets. |
---|---|
nutrient | fertilizer type of interest, default: both Nitrogen and Phosphorus. |
input_type | the source of nutrient, e.g. fertilizer or manure. |
farm_type | where the fertilizer was applied. e.g. farm, nonfarm. |
years | start year to show data, e.g. 1994, 2000:2005. |
counties | counties of interest, defalut: all avaible counties. |
states | states of interest, defalt: all avaialble states. |
lat_max | the maximum latitude of area of interest. |
lat_min | the minmum latitude of area of interest. |
long_max | the maximum longitude of area of interest. |
long_min | the minimum longitude of area of interest. |
FIPSs | FIPS numbers of interest, defalut: all the counties. |
overlap_state_county | Logic. If true, the function will overlaping the input of states and counties. If false, the function will return results either in the states or in the counties. |
combine_state_county | Logic. If true, the county will be changed into county, state, e.g. Wake, NC; If false, no changes. |
A tibble with tidy data.
link(get_FIPS)
data = fertilizer get_data(data, counties = "Wake")#> # A tibble: 14 x 12 #> FIPS State County ALAND AWATER INTPTLAT INTPTLONG Quantity Year Nutrient #> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <chr> #> 1 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 112729 1991 P #> 2 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 628958. 1984 P #> 3 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 125006 1987 P #> 4 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 719104. 1980 P #> 5 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 1566581 1954 N #> 6 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 181600 1993 P #> 7 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 501911 2007 P #> 8 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 749411. 1965 P #> 9 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 321029 2008 P #> 10 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 1973119 2000 N #> 11 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 2446130 1988 N #> 12 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 2315614 1983 N #> 13 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 2233184 1968 N #> 14 37183 NC Wake 2.16e9 5.72e7 35.8 -78.7 2594662 1978 N #> # ... with 2 more variables: Farm.Type <chr>, Input.Type <chr>get_data(data, years = 1990)#> # A tibble: 587 x 12 #> FIPS State County ALAND AWATER INTPTLAT INTPTLONG Quantity Year Nutrient #> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <chr> #> 1 17177 IL Stephe… 1.46e9 1.39e6 42.3 -89.7 9022 1990 P #> 2 51685 VA Manass… 6.56e6 2.62e3 38.8 -77.4 4625 1990 N #> 3 46021 SD Campbe… 1.90e9 9.62e7 45.8 -100. 1509 1990 N #> 4 13183 GA Long 1.04e9 9.12e6 31.7 -81.7 184 1990 N #> 5 48189 TX Hale 2.60e9 2.47e5 34.1 -102. 16234 1990 N #> 6 28111 MS Perry 1.68e9 7.64e6 31.2 -89.0 7376 1990 N #> 7 13305 GA Wayne 1.66e9 1.82e7 31.5 -81.9 847 1990 N #> 8 48429 TX Stephe… 2.32e9 6.41e7 32.7 -98.8 320271 1990 N #> 9 48099 TX Coryell 2.72e9 1.21e7 31.4 -97.8 340360 1990 P #> 10 18043 IN Floyd 3.83e8 2.65e6 38.3 -85.9 16489 1990 P #> # ... with 577 more rows, and 2 more variables: Farm.Type <chr>, #> # Input.Type <chr>get_data(data, nutrient = "N", years = 2003, states = "NC", FIPSs = 37145)#> Warning: None data selected, refine your filters!#> # A tibble: 0 x 12 #> # ... with 12 variables: FIPS <chr>, State <chr>, County <chr>, ALAND <dbl>, #> # AWATER <dbl>, INTPTLAT <dbl>, INTPTLONG <dbl>, Quantity <dbl>, Year <chr>, #> # Nutrient <chr>, Farm.Type <chr>, Input.Type <chr>