0
$\begingroup$

Issue

The function create.EfficientFrontier from the PortfolioAnalytics package is outputting an error message that reads:

Error in `colnames<-`(`*tmp*`, value = c("mean", "StdDev", "out", "w.Asset1",  : 
  attempt to set 'colnames' on an object with less than two dimensions

Troubleshooting performed so far without success

  1. Searched for identical cases - found a few cases with the same error message but output from different functions
  2. Checked if the covariance matrix was not positive definite
  3. Had recently updated the zoo package so I reinstalled the older version
  4. Besides my own code, I tried to run the example codes I found in two different blogs however, I got the exact same error once I tried to execute the function "create.EfficientFrontier".

You can check the link below for the code and specific data set in order to try to reproduce my error:

Efficient Frontier Demo from Ross Bennett (PortfolioAnalytics developer)

Three different data sets and the same error, so I suppose I might have some basic misconfiguration issue on my RStudio.

Any ideas on what the culprit could be?

Thanks in advance!

$\endgroup$
  • $\begingroup$ can't help without seeing an (reproducible) example $\endgroup$ – rbm Dec 26 '16 at 22:32
  • $\begingroup$ @rbm I just clarified the question body to make it clear about the code $\endgroup$ – Zeca Dec 27 '16 at 4:13
1
$\begingroup$

I ran into the same issue. I do not know what causes it, but I noticed that you have this error if you use the latest ROI infrastructure (released in June 2016), while the function works correctly if you use the old (2013) ROI infrastructure (and old plug-ins) still available on CRAN (see archives).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.