# NOT RUN {
# Run if HYDAT database has been downloaded (using tidyhydat::download_hydat())
if (file.exists(tidyhydat::hy_downloaded_db())) {
# Calculate long-term monthly statistics using data argument with defaults
flow_data <- tidyhydat::hy_daily_flows(station_number = "08NM116")
calc_longterm_monthly_stats(data = flow_data,
start_year = 1980)
# Calculate long-term monthly statistics using station_number argument with defaults
calc_longterm_monthly_stats(station_number = "08NM116",
start_year = 1980)
# Calculate long-term monthly statistics regardless if there is missing data for a given year
calc_longterm_monthly_stats(station_number = "08NM116",
ignore_missing = TRUE)
# Calculate long-term monthly statistics for water years starting in October
calc_longterm_monthly_stats(station_number = "08NM116",
start_year = 1980,
water_year_start = 10)
# Calculate long-term monthly statistics with custom years
calc_longterm_monthly_stats(station_number = "08NM116",
start_year = 1981,
end_year = 2010,
exclude_years = c(1991,1993:1995))
# Calculate long-term monthly statistics for 7-day flows for July-September months only,
# with 25 and 75th percentiles
calc_longterm_monthly_stats(station_number = "08NM116",
roll_days = 7,
months = 7:9,
percentiles = c(25,75),
ignore_missing = TRUE,
include_annual = FALSE) # removes the Long-term numbers
# Calculate long-term monthly statistics and add custom stats for July-September
calc_longterm_monthly_stats(station_number = "08NM116",
start_year = 1980,
custom_months = 7:9,
custom_months_label = "Summer")
}
# }
Run the code above in your browser using DataLab