Skip to content
Prev 14502 / 15274 Next

Error using Performance Analytics package

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/
On Monday, 12 March, 2018, 6:30:27 PM IST, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote:
It would be easier for others to help you if you provided a
reproducible example.? Here are some tips on how to create one:
https://stackoverflow.com/q/5963269/271616

Also, please follow the posting guide and send plain text emails, not
HTML.? The latter are likely to be mangled by the list server, which
makes them hard to read (and is another impediment to someone trying
to help).

On Mon, Mar 12, 2018 at 7:52 AM, Pankaj K Agarwal via R-SIG-Finance
<r-sig-finance at r-project.org> wrote: