Learn R Programming

tbrf (version 0.1.5)

tbr_sum: Time-Based Rolling Sum

Description

Time-Based Rolling Sum

Usage

tbr_sum(.tbl, x, tcolumn, unit = "years", n, na.rm = FALSE)

Value

dataframe with column for the rolling sum.

Arguments

.tbl

a data frame with at least two variables; time column formatted as date, date/time and value column.

x

column containing the values to calculate the sum.

tcolumn

formatted time column.

unit

character, one of "years", "months", "weeks", "days", "hours", "minutes", "seconds"

n

numeric, describing the length of the time window.

na.rm

logical. Should missing values be removed?

See Also

Examples

Run this code
tbr_sum(Dissolved_Oxygen, x = Average_DO, tcolumn = Date, unit = "years", n =
5)

Run the code above in your browser using DataLab