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