You need to use a column-aware function in apply. Weekly For example, use colSums instead of sum or colMeans instead of mean.
You need to use a column-aware function in apply.weekly. For example, use colSums instead of sum or colMeans instead of mean. The more recent revisions of xts on R-forge give the output below.
The version currently on CRAN returns the data transposed. # install. Packages("xts", repos="r-forge.r-project.org") > apply.
Weekly(zoo. Daily, colSums) a be c 2001-05-27 -1.09989120 -0.32594617 2.5178365 2001-06-03 2.31230989 0.02117512 -5.3511735 2001-06-10 0.54718941 4.34139252 -1.0462765 2001-06-13 0.06343824 2.86867857 -0.8867472 > apply. Weekly(zoo.
Daily, colMeans) a be c 2001-05-27 -0.36663040 -0.108648725 0.8392788 2001-06-03 0.33032998 0.003025018 -0.7644534 2001-06-10 0.07816992 0.620198931 -0.1494681 2001-06-13 0.02114608 0.956226189 -0.2955824 If you need to use a custom function, you can use a combination of apply. Weekly and apply: > apply. Weekly(zoo.
Daily, function(x) apply(x,2,mean)) a be c 2001-05-27 -0.36663040 -0.108648725 0.8392788 2001-06-03 0.33032998 0.003025018 -0.7644534 2001-06-10 0.07816992 0.620198931 -0.1494681 2001-06-13 0.02114608 0.956226189 -0.2955824.
Thanks! I'm always embarrassed how easy it is. – richardh Nov 30 '10 at 21:20 2 @richardh if it's any consolation, others usually work very hard to make it that easy.
;-) – Joshua Ulrich Nov 30 '10 at 21:21 Is there a setting/option I need to set to avoid having to transpose and recast as zoo? – richardh Nov 30 '10 at 21:31 @richardh apply. Weekly will return whatever time-series class passed to it (timeSeries, zoo, its, etc.).
I've included the command to download a more recent version of xts from R-forge. – Joshua Ulrich Nov 30 '10 at 21:47 Got it! Thanks for the education.
And re consolation: it only makes the embarassment stronger... I'll keep learning, and try to pay it back! Thanks! – richardh Nov 30 '10 at 22:35.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.