Agg: Temporal aggregation of environmental variables

Agg.tR Documentation

Temporal aggregation of environmental variables

Description

Function for temporal aggregation of environmental variables. Agg is a wrapper function of aggregate from stats package.

Usage

  Agg.t(data, nameData, delta, func, namePlot)

Arguments

data

A data.frame that contains the time series of the environmental variable to be aggregated, e.g. precipitation. This data.frame should have at two columns: the first one, Time [y-m-d h:m:s]; the second one, a numeric value equal to the magnitude of the environmental variable. If the environmental variable is different than precipitation, then the column name of the values can be named as the name of the variable itself.

nameData

A character string that defines the name of the environmental variable to be aggregated.

delta

A numeric value that specifies the level of aggregation required in minutes.

func

The name of the function of aggregation e.g. mean, sum.

namePlot

A character string that defines the title of the plot generated.

Value

A data.frame with two columns:

time

the date-time time series of the aggregated variable

value

time series with the magnitude of the aggregated variable.

Author(s)

J.A. Torres-Matallana

Examples


## temporal aggregation
library(EmiStatR)
data(P1)
colnames(P1) <- c("time", "P1")
head(P1)

library(stUPscales)
P1.agg <- Agg.t(data = P1, nameData = "P1", delta = 120 , func = sum, 
              namePlot = "Temporal aggregation of precipitation P1")

head(P1.agg)
tail(P1.agg)


stUPscales documentation built on Sept. 18, 2023, 9:07 a.m.