aggregateDays2Months: Aggregate Days to Months

View source: R/aggregateDays2Months.R

aggregateDays2MonthsR Documentation

Aggregate Days to Months

Description

Aggregation of many Days over several years to Months is possible with this function

Usage

aggregateDays2Months(Time,Data,FUN,Header,Period="month", ...)

Arguments

Time

[1:n] vector of POSIXlt or POSIXct or as.Date obects

Data

[1:n,1:d] matrix or dataframe, d can be also 1, then vector

FUN

aggregate by a function like sum or mean

Header

colnames for data

Period

string defining the period, but only "month" was tested

...

further arguments passed on to FUN

Details

A shortcut for aggregation using dplyr

Value

dataframe[1:m,1:(d+1)] with m<n and first column being the time in as.Date format

Author(s)

Michael Thrun

Examples

#Generating Data
data(Sales)
Time=seq(from=as.Date('1970-01-01'),by='1 day',length.out = 2*length(Sales))
#Aggregation
Monthly=aggregateDays2Months(Time,c(Sales,Sales),sum)
str(Monthly)

Mthrun/TSAT documentation built on Feb. 5, 2024, 11:15 p.m.