[R-SIG-Finance] Error using Performance Analytics package

Pankaj K Agarwal pankajsbi at yahoo.com
Tue Mar 13 15:30:11 CET 2018


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:
> Dear all,I am using a dataset of monthly asset returns. I subset it with window() call of package zoo. When i try to compute Modified VaR on this subset, i am getting the following error:
> Error in dimnames(cd) <- list(as.character(index(x)), colnames(x)) :  'dimnames' applied to non-array
> Can someone help? I googled it a lot but still nothing seems to be working.
> Regards,
> Pankaj K Agarwal
> +91-98397-11444http://in.linkedin.com/in/pankajkagarwal/
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com
  
	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list