[R-SIG-Finance] apply.fromstart() warnings

Murali Menon feanor0 at hotmail.com
Mon Jun 2 13:57:03 CEST 2008



Folks,

When I attempt to find the growing window columnwise mean of a two-dimensional array, I get a bunch of warnings. Any idea why? Here's my code:

> library(PerformanceAnalytics)

> d <- zoo(matrix(rnorm(50), ncol=2), order.by=as.Date(1:25))

> apply.fromstart(d, gap=20, FUN="mean")
1970-01-02          NA          NA
1970-01-03          NA          NA
1970-01-04          NA          NA
1970-01-05          NA          NA
1970-01-06          NA          NA
1970-01-07          NA          NA
1970-01-08          NA          NA
1970-01-09          NA          NA
1970-01-10          NA          NA
1970-01-11          NA          NA
1970-01-12          NA          NA
1970-01-13          NA          NA
1970-01-14          NA          NA
1970-01-15          NA          NA
1970-01-16          NA          NA
1970-01-17          NA          NA
1970-01-18          NA          NA
1970-01-19          NA          NA
1970-01-20          NA          NA
1970-01-21 -0.05899970 -0.05899970
1970-01-22 -0.05882669 -0.05882669
1970-01-23 -0.08635806 -0.08635806
1970-01-24 -0.15848480 -0.15848480
1970-01-25 -0.13168358 -0.13168358
1970-01-26 -0.17101046 -0.17101046
There were 12 warnings (use warnings() to see them)


When I check the warnings(), here's the first string I get:

1: In column.Return.calc[i] = apply(as.matrix(data.zoo[,  ... :
  number of items to replace is not a multiple of replacement length

I'm not sure why this should be the case?


I'm using:

> packageDescription("zoo")$Version
[1] "1.4-2"
> packageDescription("PerformanceAnalytics")$Version
[1] "0.9.6"


And R 2.6.1 on Windows XP.


Thanks,


Murali

_________________________________________________________________
Give to a good cause with every e-mail. Join the i’m Initiative from Microsoft.



More information about the R-SIG-Finance mailing list