Skip to contents

Calculates the historical max, mean, minimum, and number of available points for each day of the year

Usage

daily_frequency_table(
  gw_level_dv,
  gwl_data,
  parameter_cd = NA,
  date_col = c("time", "time"),
  value_col = c("value", "value"),
  approved_col = c("approval_status", "approval_status")
)

Arguments

gw_level_dv

data frame, daily groundwater level data. Often obtained from read_waterdata_daily. Use NULL for no daily data.

gwl_data

data frame returned from read_waterdata_field_measurements, or data frame with a date, value, and approval columns. Use NULL for 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".

Value

a data frame giving the max, mean, min, and number of available days of data for each day of the year.

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

daily_frequency_table(gw_level_dv,
                      NULL,
                      parameter_cd = "62610")
#> # A tibble: 366 × 5
#>      DOY   max  mean   min points
#>    <dbl> <dbl> <dbl> <dbl>  <int>
#>  1     1 -5.29 -21.6 -41.4     45
#>  2     2 -5.24 -21.6 -40.1     45
#>  3     3 -5.3  -21.7 -40.2     45
#>  4     4 -5.55 -21.7 -41.6     45
#>  5     5 -5.48 -21.8 -40.5     45
#>  6     6 -5.71 -21.8 -40.6     45
#>  7     7 -5.64 -21.9 -42.2     45
#>  8     8 -5.75 -21.8 -41.4     45
#>  9     9 -5.52 -21.7 -40.5     46
#> 10    10 -5.3  -21.7 -40.6     46
#> # ℹ 356 more rows

# gwl_data <- dataRetrieval::read_waterdata_field_measurements(monitoring_location_id = site)
gwl_data <- L2701_example_data$Discrete
                                 
daily_frequency_table(gw_level_dv,
                      gwl_data,
                      parameter_cd = "62610")
#> # A tibble: 366 × 5
#>      DOY   max  mean   min points
#>    <dbl> <dbl> <dbl> <dbl>  <int>
#>  1     1 -5.29 -21.6 -41.4     45
#>  2     2 -5.24 -21.6 -40.1     45
#>  3     3 -5.3  -21.4 -40.2     46
#>  4     4 -5.55 -21.7 -41.6     45
#>  5     5 -5.48 -22.1 -40.5     47
#>  6     6 -5.71 -21.7 -40.6     46
#>  7     7 -5.64 -21.9 -42.2     45
#>  8     8 -5.75 -21.7 -41.4     46
#>  9     9 -5.52 -21.7 -40.5     47
#> 10    10 -5.3  -21.7 -40.6     46
#> # ℹ 356 more rows