ggfertilizer— title: “Get started with ggfertilizer” author: “Wenlong Liu” date: “2018-07-13” output: rmarkdown::html_vignette vignette: > % % % —

Retrieve, Summarize and Visualize the Fertilizer Data in USA

Provides a user-friendly API to further dig in County-Level Fertilizer data in USA, provided by USGS.

Installation

This package can be installed via CRAN.

Quick Start

Summarize and plot data.

Example 1: Find out the top 10 counties with most nitrogen appliation in 2008.

# plot the top 10 nitrogen application in year 2008.
plot <- plot_data %>% 
  top_n(10, Quantity) %>%
  ggplot(aes(x=reorder(County, Quantity), Quantity, fill = Quantity))+
  scale_fill_gradient(low = "blue", high = "darkblue")+
  geom_col()+
  ggtitle(paste("Top 10 counties with most N fertilizer application in the year of", Year)) + 
  scale_y_continuous(name = "Nitrogen from commecial fertilization (kg)")+
  scale_x_discrete(name = "Counties")+
  coord_flip()+
  theme_bw()
plot

Examples 2: Visualize the fertilizer data in US maps.

As the maps are actually ggplot2 objects, all the common API for ggplot2 can be used here. We can also add a title for the map to make it more informative.

us_plot +
  ggtitle(paste(Nutrient,  " from ", Input_Type, " input to ", Farm_Type, " in the year of ",Year,
                     " at ", level, " level",sep = ""))

For more details about mapping fertilizer data, please see this vignettes

Visualize the fertilizer data for different states.

Generate summaries plots.

(under development on July 10, 2018)

Comments and Questions

If you have any problems or questions, feel free to open an issue here.

Lisence

GPL