keepMax: De-duplicating while Retaining Max

Description Usage Arguments Details Examples

Description

This function returns unique entries from a data frame with the highest value in a specified column of interest.

Usage

1
keepMax(df, x, value, max = TRUE)

Arguments

df

A dataframe

x

A character vector of column names to remove on

value

A character entry to sort on and keep the largest (or smallest) value

max

Optional parameter to keep max or min value. Defaults to keeping max.

Details

This function is specifically for fulfilling common data-call requests. An example is radon measurements at residences each year. If a given residence has more than one measurement in a given year, only the most elevated test should be sent.

Examples

1
2
3
4
data(iris)
x <- c("Petal.Length", "Petal.Width")
value <- "Sepal.Length"
keepMax(iris, x, value)

HFBrowning/EnvEpi documentation built on May 6, 2019, 9:46 p.m.