apply.daily.columns: Columnwise apply a function to receive hourly or daily...

View source: R/apply.daily.columns.r

apply.daily.columnsR Documentation

Columnwise apply a function to receive hourly or daily aggregated values

Description

Apply a specified function to each column of an xts object creating hourly, daily or monthly values

Usage

apply.daily.columns(x, FUN, agg = "day", PB = "n", tz = NULL, ...)

Arguments

x

an xts object

FUN

an R function

agg

character string to specify whether to receive monthly, weekly, daily or hourly values, respectively. See details.

PB

a character indicating whether and what kind of progress bar should be drawn. See details.

tz

character specifying the time zone or NULL (the standard). If the latter, the time zone of x is used

...

additional arguments to FUN

Details

A simple mechanism to use apply.daily, apply.hourly, apply.weekly or apply.monthly to each column of an xts object.

By setting PB, an optional progressbar can be drawn: "w" or "win" draws a winProgressBar, "t" or "txt" draws a txtProgressBar and "n" or "none" (the default) suppresses the progress bar.

Value

An xts object containing hourly, daily, ... values

Author(s)

Simon Frey

See Also

apply.daily

apply.hourly

apply.monthly

apply.weekly

Examples

 
    # load precipitation input
    data(precipitation)
    head(x)
    
    # aggregate to daily values
    aday <- apply.daily.columns(x, FUN = sum, agg = 'day', PB = 'txt')
    head(aday)

freysimon/TigeR documentation built on April 18, 2024, 4:57 p.m.