[R-SIG-Finance] Error in using PerformanceAnalytics package.

Pankaj K Agarwal pankajsbi at yahoo.com
Tue Mar 13 15:33:17 CET 2018


Apologies that data file was not attached in the previous mail
Dear Joshua SirHere is my data and my code:
R Version 3.4.2
1. Data:File:data.csvMonthly returns of 210 assets from April 2006 till March 2015
2. Code:#Reading filedat1<-read.csv("data.csv",header=TRUE,stringsAsFactors=FALSE)#Load zoolibrary(zoo)#Creating a zoo objectdat1.z<-read.zoo(dat1, header = TRUE, FUN =function(x) as.yearmon(format(x, nsmall = 2),"%b-%y"))#Subseting datatestdata<-window(dat1.z,start=as.yearmon("Apr 2006"),end=as.yearmon("Mar 2010"))#Computing VaRlibrary(PerformanceAnalytics)library(PortfolioAnalytics)VaR(as.matrix(testdata)/100,p=0.95,method="modified")
Problem:The last command gives the following output:
Error in dimnames(cd) <- list(as.character(index(x)), colnames(x)) :   'dimnames' applied to non-array
Kindly advise how to resolve it. 


Regards,Pankaj K Agarwal
+91-98397-11444http://in.linkedin.com/in/pankajkagarwal/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20180313/21818221/attachment.html>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: data.csv
Type: application/vnd.ms-excel
Size: 241112 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20180313/21818221/attachment.xlb>


More information about the R-SIG-Finance mailing list