plot_inventory_data: Produce an bar chart of frequencies of missing data

View source: R/plot_inventory_data.R

plot_inventory_dataR Documentation

Produce an bar chart of frequencies of missing data

Description

Returns a bar chart using ggplot2 that displays the frequency of missing data for each element and station given. Takes a data frame as an input and the relevant columns to create the plot.

Usage

plot_inventory_data(
  data,
  elements,
  station = NULL,
  y = c("count", "percentage"),
  columns = c("elements", "stations"),
  fill = c("none", "stations", "elements"),
  facet_by = c("stations", "elements", "none"),
  display_perc = FALSE,
  display_count = FALSE,
  title = "Inventory Plot",
  x_title = NULL,
  y_title = NULL,
  coord_flip = FALSE
)

Arguments

data

The data.frame to calculate from

elements

The name of the columns in data to apply the summary calculation to.

station

The name of the station column in data, if the data are for multiple station. The summary table is calculated separately for each station.

y

Whether to display counts or percentages.

columns

Whether to display stations or elements on the columns.

fill

Whether to fill by stations, elements, or neither.

facet_by

Whether to facet by stations, elements, or neither

display_perc

logical. Whether to display percentage values on the plot.

display_count

logical. Whether to display the count values on the plot.

title

The text for the title.

x_title

The text for the x-axis.

y_title

The text for the y-axis.

coord_flip

logical. Whether to switch the x and y axes.

Value

A plot of type ggplot to the default plot device

Examples

data(daily_niger) 
plot_inventory_data(data = daily_niger, station = "station_name",
                    elements = c("tmin", "tmax"),
                    columns = "stations", facet_by = "elements")
                    
# can omit station argument
plot_inventory_data(data = daily_niger, 
                    elements = c("tmin", "tmax"))

# can view percentage instead
plot_inventory_data(data = daily_niger, y = "percentage",
                    elements = c("tmin", "tmax"), display_perc = TRUE,
                    display_count = TRUE)

IDEMSInternational/cdms.products documentation built on July 7, 2023, 10:13 a.m.