apply.hourly: aggregate xts object to hourly values

Description Usage Arguments Details Author(s) See Also Examples

View source: R/functions.r

Description

Aggregate an xts object to hourly values. It is a wrapper of period.apply with endpoints = "hours"

Usage

1
apply.hourly(x, FUN, roundtime = "round", na.rm = TRUE)

Arguments

x

xts object

FUN

function to apply to x

roundtime

character. Valid are "NA", "round", and "trunc", See details

na.rm

loggical. Should ne values be removed?

Details

An xts object is aggregated to hourly values. Using the parameter roundtime, the timestamp of the xts object can be round to full hours. This can be done by rounding to the nearest full hour, or by going to the last full hour (trunc). NA skips rounding.

Author(s)

Simon Frey

See Also

period.apply

Examples

1
2
3
4
    library(TigR)
    library(xts)
    x <- xts(runif(6,1,100), order.by = as.POSIXct(c("2000-01-20 10:55","2000-01-20 10:59","2000-01-20 11:20","2000-01-20 12:35", "2000-01-20 12:45", "2000-01-20 13:45")))
    apply.hourly(x, FUN = mean, roundtime = "round")

freysimon/TigR documentation built on March 4, 2020, 9:01 a.m.