I am trying to understand from this example if lubridate can be applied to apply.daily but don't quite understand how to do that. can I get any reference to using lubridate with apply.daily so I can exclude weekends using apply.daily
Stackoverflow: Wrong week-ending date using 'to.weekly' function in 'xts' package
EDIT: using Richie Cotton's example as a guide, I wrote the following:
> is.weekend <- function(x) {
+ w <- as.POSIXlt(x)
+ w %in% c(1,7)
+ }
> apply.daily(core[!is.weekend(x)],dfun)
Error in as.POSIXlt.default(x) :
do not know how to convert 'x' to class "POSIXlt"
> apply.daily(core[!is.weekend(index(x))],dfun)
Error in as.POSIXlt.numeric(x) : 'origin' must be supplied
> alpha <- core[!is.weekend(index(x))]
Error in as.POSIXlt.numeric(x) : 'origin' must be supplied
>
Where is my error? Am I missing a particular library?