How can I apply a summary function to a time of day subset?
For example with:
r[\'T16:00/T17:00\']$Value
How can I apply something like
You can use apply.daily
to apply a function to each day's data after you've done the time-of-day subset.
rt <- r['T16:00/T17:00','Value']
rd <- apply.daily(rt, function(x) xts(t(quantile(x,0.9)), end(x)))
You can see I needed to do a few backflips to ensure the object returned from your function can be handled by apply.daily
. Mainly, it has to be a multi-column xts object with one row.