county_aggregates: Get county level output

Description Usage Arguments Value Examples

View source: R/analyze_data.R

Description

Function aggregates gage-level output into county-level output

Usage

1
county_aggregates(flood_stats, county_cd)

Arguments

flood_stats

Data frame of gage-level output from flood_analysis function.

county_cd

Character vector with the county FIPS code(s)

Value

A data frame with the following columns:

Name Type Description
county character County name
state character State name
num_gage numeric Number of analyzed gages in county
avg_peak numeric Average flood ratio among county gages
max_peak numeric Maximum observed flood ratio
minor numeric Percentage of gages at or above "minor" flood class (flood ratio > 1)
moderate numeric Percentage of gages at or above "moderate" flood class (flood ratio > 1.5)
major numeric Percentage of gages at or above "major" flood class (flood ratio > 2)
extreme numeric Percentage of gages at or above "extreme" flood class (flood ratio > 5)
max_dur numeric Maximum flood duration in county
avg_dur numeric Average flood duration in county

If threshold = "NWS", the columns "minor", "moderate", "major", and "extreme" are replaced with two columns: "no_flood" and "yes_flood" which show the percentage of gages in the county with or without flooding.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
va_counties <- get_county_cd("Virginia")
va_gages <- get_gages(va_counties, start_date = "2015-01-01",
                      end_date = "2015-12-31")
va_flow_data <- get_flow_data(va_gages, start_date = "2015-01-01",
                      end_date = "2015-12-31")
va_peaks <- find_q2(va_gages$site_no)
va_stats <- flood_analysis(flow_data = va_flow_data, peaks = va_peaks,
                       gages = va_gages, county_cd = va_counties, threshold = "Q2")
va_county_stats <- county_aggregates(flood_stats = va_stats)

## End(Not run)

countyfloods documentation built on May 2, 2019, 2:38 a.m.