# NOT RUN {
# Run if HYDAT database has been downloaded (using tidyhydat::download_hydat())
if (file.exists(tidyhydat::hy_downloaded_db())) {
# Calculate statistics using a data frame and data argument with defaults
flow_data <- tidyhydat::hy_daily_flows(station_number = "08NM116")
calc_monthly_stats(data = flow_data,
start_year = 1980)
# Calculate statistics using station_number argument with defaults
calc_monthly_stats(station_number = "08NM116",
start_year = 1980)
# Calculate statistics regardless if there is missing data for a given year
calc_monthly_stats(station_number = "08NM116",
ignore_missing = TRUE)
# Calculate statistics for water years starting in October
calc_monthly_stats(station_number = "08NM116",
start_year = 1980,
water_year_start = 10)
# Calculate statistics with custom years
calc_monthly_stats(station_number = "08NM116",
start_year = 1981,
end_year = 2010,
exclude_years = c(1991,1993:1995))
# Calculate statistics for 7-day flows, with 25 and 75th percentiles
calc_monthly_stats(station_number = "08NM116",
roll_days = 7,
percentiles = c(25,75),
ignore_missing = TRUE)
}
# }
Run the code above in your browser using DataLab