apply.hourly | R Documentation |
Aggregate an xts object to hourly values. It is a wrapper of period.apply
with endpoints = "hours"
apply.hourly(x, FUN, roundtime = "round", na.rm = TRUE)
x |
xts object |
FUN |
function to apply to x |
roundtime |
character. Valid are |
na.rm |
logical. Should ne values be removed? |
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.
Simon Frey
period.apply
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.