View source: R/plot_annual_symbols.R
plot_annual_symbols | R Documentation |
Plots data symbols for a daily data set by year, either by day of year, total days, or percent of year (see
plot_type
argument. A column of symbols is required, default symbols = 'Symbol'
. For HYDAT data, symbols
include: 'E' Estimate, 'A' Partial Day, 'B' Ice Conditions, 'D' Dry, and 'R' Revised. Other symbols or categories may be
used to colour points of plot. Returns a list of plots.
plot_annual_symbols(
data,
dates = Date,
values = Value,
groups = STATION_NUMBER,
symbols = Symbol,
station_number,
water_year_start = 1,
start_year,
end_year,
months = 1:12,
include_title = FALSE,
plot_type = "dayofyear"
)
data |
Data frame of daily data that contains columns of dates, flow values, and (optional) groups (e.g. station numbers).
Leave blank or set to |
dates |
Name of column in |
values |
Name of column in |
groups |
Name of column in |
symbols |
Name of column in |
station_number |
Character string vector of seven digit Water Survey of Canada station numbers (e.g. |
water_year_start |
Numeric value indicating the month ( |
start_year |
Numeric value of the first year to consider for analysis. Leave blank or set well before start date (i.e.
|
end_year |
Numeric value of the last year to consider for analysis. Leave blank or set well after end date (i.e.
|
months |
Numeric vector of months to include in plotting For example, |
include_title |
Logical value to indicate adding the group/station number to the plot, if provided. Default |
plot_type |
Character. One of |
A list of ggplot2 objects with the following for each station provided:
Annual_Symbols |
a plot that contains data symbols and missing dates |
# Run if HYDAT database has been downloaded (using tidyhydat::download_hydat())
if (file.exists(tidyhydat::hy_downloaded_db())) {
# Plot annual symbol counts from a data frame and data argument
flow_data <- tidyhydat::hy_daily_flows(station_number = "08NM116")
plot_annual_symbols(data = flow_data)
# Plot annual symbol counts using station_number argument with defaults
plot_annual_symbols(station_number = "08NM116")
# Plot annual symbol percentages using station_number argument and plot by annual counts
plot_annual_symbols(station_number = "08NM116",
plot_type = "count")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.