Calculates summary statistics on daily depth means.

lake_summary_stats(data, col_date, col_depth, col_measure, below_threshold = 2)

Arguments

data

data frame

col_date

Column name, Date

col_depth

Column name, Depth

col_measure

Column name, measurement for calculation

below_threshold

Threshold below which to count number of days for measured value. Default = 2

Value

data frame in long format.

Details

Input data is assumed to be a single lake location depth profile with one measurement per day and depth. The function daily_depth_means can be used to generate this type of data from continuous data with multiple measurements per day for each depth.

Calculated statistics are:

* minimum

* maximum

* range

* mean

* median

* quantiles (1, 5, 10, 25, 50, 75, 90, 95, 99)

Statistics are calculated for multiple time periods:

* entire dataset

* year

* month

* year month

A data frame is returned in a hybrid long format. Statistics will be columns and time periods will also be a column with the values for each row. That is , if time period is month then each month will be a row with each statistic in a column.

Examples

# data
data <- laketemp_ddm

# Columns
col_date    <- "Date"
col_depth   <- "Depth"
col_measure <- "Measurement"
below_threshold <- 2

# Calculate Stratification
df_lss <- lake_summary_stats(data
                            , col_date
                            , col_depth
                            , col_measure
                            , below_threshold)

# Results
head(df_lss)
#> # A tibble: 6 × 23
#> # Groups:   TimeFrame_Value, Depth [6]
#>   TimeFra…¹ TimeF…² Depth     n ndays  mean median   min   max range    sd   var
#>   <chr>     <chr>   <dbl> <int> <int> <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 AllData   AllData     2   357   357  8.50   4.91 0.371  22.1  21.7  7.46  55.6
#> 2 AllData   AllData     3   357   357  8.49   4.93 0.413  22.0  21.6  7.39  54.6
#> 3 AllData   AllData     4   357   357  8.41   4.91 0.404  21.9  21.5  7.33  53.8
#> 4 AllData   AllData     5   357   357  8.32   4.88 0.395  21.8  21.4  7.25  52.6
#> 5 AllData   AllData     6   357   357  8.20   4.86 0.389  20.9  20.5  7.12  50.7
#> 6 AllData   AllData     7   357   357  8.02   4.87 0.401  19.9  19.5  6.89  47.5
#> # … with 11 more variables: cv <dbl>, q01 <dbl>, q05 <dbl>, q10 <dbl>,
#> #   q25 <dbl>, q50 <dbl>, q75 <dbl>, q90 <dbl>, q95 <dbl>, q99 <dbl>,
#> #   n_below_2 <dbl>, and abbreviated variable names ¹​TimeFrame_Name,
#> #   ²​TimeFrame_Value