aggreg: Aggregate xts object

Description Usage Arguments Value Author(s) See Also Examples

View source: R/CMISCorrelacaoExtraFunctions.R

Description

Aggregate xts object by a given function. It can be any function defined by the user. Actually it's possible to aggregate data by day, month, week, quarter and year.

Usage

1
aggreg(daxts, FUN, freq = "daily", dig = 4, ...)

Arguments

daxts

object of calss xts with simple or multiple columns

FUN

a function defined by the user.

freq

a char string to the aggregation. It can be daily, weekly, monthly, quarterly or yearly

dig

number of output digits

Value

a object from class xts with the data aggregated

Author(s)

LOPES, J. E.

See Also

apply.daily

Examples

1
2
3
4
5
data(diario)
d1 <- ConvertData(diario,  tsfrequency = "day", outType = "xts", OutlierClean = FALSE)
fun1 <- function(x) {c(mean(x, na.rm=TRUE) + sd(x,na.rm=TRUE))}
aggreg(d1[,1:5], fun1, "monthly")
aggreg(d1[,1:5], mean, "monthly")

evandeilton/RTFC documentation built on May 29, 2019, 10:37 a.m.