data_preparation: Prepare data for visualization.

Description Usage Arguments Value Author(s) See Also Examples

Description

The built-in function of data preparation for mapping and plotting. If you want to fetch the whole data, please prefer using get_data().

Usage

1
2
3
4
5
6
data_preparation(data, Year, Nutrient, County = NULL, State = NULL,
  Farm_Type = NULL, Input_Type = NULL, lat_max = NULL, lat_min = NULL,
  long_max = NULL, long_min = NULL, FIPSs = NULL,
  overlap_state_county = TRUE, combine_state_county = FALSE, fun = NULL,
  annual_change = NULL, facet = NULL, level = "county", na.rm = TRUE,
  ...)

Arguments

data

the dataset to plot. default: us_fertilizer_county.

Year

the temporal coverage of the data to visualize. See link for available period.

Nutrient

the nutrient type of fertilizer from usfertilizer. Has to be N, P or both (NULL).

County

the counties that will show in the plot, default: all counties.

State

the states that will show in the plot,default: all states.

Farm_Type

the spatial source of fertilizer, should be farm, nonfarm or both.

Input_Type

the input source of fertilizer, should be manure, fertilizer.

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.

fun

the function to process data, not done yet.

annual_change

to check if the data represent the annual change, default: FALSE.

facet

the facet to draw subplots.

level

the spatial resolution of map, should be county or state, default county.

na.rm

How to deal with NA values. Default: TRUE.

...

extra parameters for link(get_data)

Value

A tibble with tidy data.

Author(s)

Wenlong Liu

See Also

link(data_overview), link(get_FIPS), link(get_data)

Examples

1
2
3
4
5
6
7
8
require(ggfertilizer)
require(usfertilizer)
data("us_fertilizer_county")

plot_data = data_preparation(data = us_fertilizer_county,
                             Year = 2003,
                              Nutrient = "N")
head(plot_data)

wenlong-liu/ggfertilizer documentation built on May 28, 2019, 8:43 a.m.