View source: R/apply.daily.columns.r
apply.daily.columns | R Documentation |
Apply a specified function to each column of an xts object creating hourly, daily or monthly values
apply.daily.columns(x, FUN, agg = "day", PB = "n", tz = NULL, ...)
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 |
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.
An xts object containing hourly, daily, ... values
Simon Frey
apply.daily
apply.hourly
apply.monthly
apply.weekly
# load precipitation input
data(precipitation)
head(x)
# aggregate to daily values
aday <- apply.daily.columns(x, FUN = sum, agg = 'day', PB = 'txt')
head(aday)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.