Reputation: 1775
I'm using the zoo and xts package for analysing financial data. ts package is not very suitable since financial series have weekend with no data available.
I read about the apply function availbale in the xts package
apply.daily(x, FUN, ...)
apply.weekly(x, FUN, ...)
apply.monthly(x, FUN, ...)
apply.quarterly(x, FUN, ...)
apply.yearly(x, FUN, ...)
this apply function over calendar periods and thought that something like that will work in order to get the end of week value but it seems not to work.
apply.weekly(x, tail)
Upvotes: 3
Views: 3949
Reputation: 176728
apply.weekly(x, tail)
doesn't work because tail
returns the last 6 observations by default. Use apply.weekly(x, tail, 1)
instead.
Upvotes: 2