getGroupValue: Extract Max Record from Date-based Groups

Description Usage Arguments Details Value

View source: R/getGroupValue.R

Description

This function uses the group_by() functions from the dplyr package and applies the with_ties = FALSE option to retain only one record per group. The group column can be a date object, an integer, or character variable to group by.

Usage

1
2
3
4
5
6
7
getGroupValue(
  df,
  groupColumn,
  valueColumn,
  value = "max",
  dateGroup = "noDate"
)

Arguments

df

A data.frame or tibble data object including a date and value column

groupColumn

The column name, character or integer, of the group column. Can be a blocking variable representing sites, dates, or other groups. If using complete dates (year, month, day present) ensure as.date format yyyy-mm-dd. Incomplete dates (i.e. only years) should remain as integers.

valueColumn

The column name, character or integer, of the data values to be tested.

value

The value to be returned, either "min", "max", "mean", or "median.

dateGroup

If using a date formatted groupColumn, specify whether grouping by "year", "month", or "day".

Details

Identify and retain only max or min value from grouped data

Value

A data.frame of test results: number of points and high and low confidence intervals. One row per dataframe in the provided list.


gdelaplante/WRBTrends documentation built on Feb. 18, 2022, 2:36 a.m.