I use PerformanceAnalytics::table.CalendarReturns
to produce a table of calendar returns of a randomly generated xts
.
library("xts")
library("PerformanceAnalytics")
set.seed(0)
n <- 150
data <- xts(100 + cumsum(rnorm(n, 0.03, 0.1)), Sys.Date() + (1:n))
ret <- Return.calculate(data,"log")
PerformanceAnalytics::table.CalendarReturns(ret)
For this code I get the following error:
Error in matrix(unlist(value, recursive = FALSE, use.names = FALSE), nrow = nr, :
'data' must be of a vector type, was 'NULL'
R and all packages are update to date. The following is my session info:
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] PerformanceAnalytics_1.4.3541 xts_0.9-7 zoo_1.7-11
loaded via a namespace (and not attached):
[1] grid_3.1.2 lattice_0.20-29 tools_3.1.2