
Create a table of monthly frequency analysis
monthly_frequency_table.RdThe table will accept daily, discrete, or a both types of data. The median of each
year/month is calculated. Then using that median, monthly stats are calculated.
Percentiles are calculated using the quantile function with "type=6".
Arguments
- gw_level_dv
data frame, daily groundwater level data. Often obtained from
read_waterdata_daily. UseNULLfor no daily data.- gwl_data
data frame returned from
read_waterdata_field_measurements, or data frame with a date, value, and approval columns. UseNULLfor no discrete data.- parameter_cd
Can be used to filter data if the data frame has a "parameter_code" column. The default is
NA, which will not do any filtering. If the gwl_data and gw_level_dv need different parameter code filtering, use a vector of 2 parameter codes. The first one will filter the gw_level_dv data frame, the second will filter the gwl_data data frame.- date_col
the name of the time columns. The first value is associated with the gw_level_dv input, and the second value is associated with the gwl_data input. The default is
c("time", "time").- value_col
the name of the value columns. The first value is associated with the gw_level_dv input, and the second value is associated with the gwl_data input. The default is
c("value", "value").- approved_col
the name of the column to get provisional/approved status. The first value is associated with the gw_level_dv input, and the second value is associated with the gwl_data input. The default is
c("approval_status", "approval_status"). It is expected that these columns will have only "Approved" or "Provisional".- flip
logical. If
TRUE, flips labels so that the lower numbers are in the higher percentages. Default isTRUE.
Value
a data frame of monthly groundwater level statistics including the 5th, 10th, 25th, 75th, 90th, and 95th percentiles; the number of years of data; and the lowest monthly median and the highest monthly median.
Examples
site <- "USGS-263819081585801"
p_code_dv <- "62610"
statCd <- "00001"
# gw_level_dv <- dataRetrieval::read_waterdata_daily(monitoring_location_id = site,
# parameter_code = p_code_dv,
# statistic_id = statCd)
gw_level_dv <- L2701_example_data$Daily
monthly_frequency <- monthly_frequency_table(gw_level_dv,
NULL)
head(monthly_frequency)
#> # A tibble: 6 × 11
#> month p05 p10 p25 p50 p75 p90 p95 nYears minMed maxMed
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl>
#> 1 1 -37.8 -32.2 -29.1 -20.2 -16.9 -10.9 -7.15 46 -41.8 -5.68
#> 2 2 -40.4 -32.5 -28.8 -21.4 -17.7 -12.3 -7.64 47 -42.8 -7.25
#> 3 3 -40.8 -35.5 -29.9 -22.8 -18.8 -12.1 -7.81 47 -45.1 -6.87
#> 4 4 -44.6 -39.0 -31.3 -25.3 -21.7 -15.0 -10.4 46 -48.5 -9.34
#> 5 5 -45.7 -39.8 -33.8 -27.0 -23.2 -17.6 -14.2 46 -49.4 -10.0
#> 6 6 -41.6 -37.7 -32.1 -26.6 -20.3 -15.6 -13.7 45 -42.8 -11.0
# gwl_data <- dataRetrieval::read_waterdata_field_measurements(monitoring_location_id = site)
gwl_data <- L2701_example_data$Discrete
monthly_frequency_combo <- monthly_frequency_table(gw_level_dv = gw_level_dv,
gwl_data = gwl_data,
parameter_cd = "62610")
head(monthly_frequency_combo)
#> # A tibble: 6 × 11
#> month p05 p10 p25 p50 p75 p90 p95 nYears minMed maxMed
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl>
#> 1 1 -37.6 -32.2 -29.4 -20.3 -17.2 -11.0 -7.21 47 -41.8 -5.68
#> 2 2 -40.4 -32.6 -28.9 -21.4 -17.7 -12.3 -7.64 47 -42.9 -7.25
#> 3 3 -41.0 -35.6 -29.9 -22.8 -18.8 -12.1 -7.81 47 -45.2 -6.87
#> 4 4 -44.5 -39.0 -31.4 -25.2 -21.6 -15.1 -10.5 47 -48.4 -9.36
#> 5 5 -45.7 -39.8 -33.8 -27.0 -23.2 -17.6 -14.2 46 -49.4 -10.0
#> 6 6 -41.6 -37.8 -32.3 -26.7 -20.2 -15.6 -13.7 45 -42.8 -11.0
monthly_flip <- monthly_frequency_table(gw_level_dv,
gwl_data,
parameter_cd = "62610",
flip = TRUE)
head(monthly_flip)
#> # A tibble: 6 × 11
#> month p05 p10 p25 p50 p75 p90 p95 nYears minMed maxMed
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl>
#> 1 1 -7.21 -11.0 -17.2 -20.3 -29.4 -32.2 -37.6 47 -5.68 -41.8
#> 2 2 -7.64 -12.3 -17.7 -21.4 -28.9 -32.6 -40.4 47 -7.25 -42.9
#> 3 3 -7.81 -12.1 -18.8 -22.8 -29.9 -35.6 -41.0 47 -6.87 -45.2
#> 4 4 -10.5 -15.1 -21.6 -25.2 -31.4 -39.0 -44.5 47 -9.36 -48.4
#> 5 5 -14.2 -17.6 -23.2 -27.0 -33.8 -39.8 -45.7 46 -10.0 -49.4
#> 6 6 -13.7 -15.6 -20.2 -26.7 -32.3 -37.8 -41.6 45 -11.0 -42.8