'ROI only solves mean, var/StdDev, HHI error in Rstudio what am i doing wrong?

when i use ROI solver of the portfolioAnalylitics package i get this error ...ROI only solves mean, var/StdDev, HHI . but i am giving it the objective stdDev . some people who ran in to the same problem talked about using the plugins , library(ROI.plugin.quadprog) library(ROI.plugin.glpk). but that does not fix the problem for me .what am i doing wrong ?

library(quantmod)
library(PerformanceAnalytics)
library(PortfolioAnalytics)
library(ROI)
library(ROI.plugin.quadprog)
library(ROI.plugin.glpk)


tickers <- c("CCL", "KIE", "KRE", "GRMN", "LOGI", "BAR")

portfolioprices <- NULL
for(ticker in tickers) {portfolioprices <-cbind(portfolioprices,getSymbols.yahoo(ticker , from = "2007-01-01" , periodicity = "daily", auto.assign = F))}

portfolioreturns <-na.omit(ROC(portfolioprices))

portf <- portfolio.spec(colnames(portfolioreturns))

portf <-add.constraint(portf, type="weight_sum", min_sum=0.99 , max_sum=1.01)
portf <-add.constraint(portf , type="box" , min=.05, max=.40)
portf <-add.objective(portf , type="return" , name="mean")
portf <-add.objective(portf , type="risk" , name="stdDev")

optPort <-optimize.portfolio(portfolioreturns,portf , optimize_method = "ROI" , trace= TRUE)

chart.Weights(optPort)



ef <- extractEfficientFrontier(optPort, match.col = "StdDev" , n.portfolio =25 ,risk_aversion = NULL) 



chart.EfficientFrontier(ef, match.col = "StdDev" , n.portfolio =25 ,risk_aversion = NULL, 
                        xlim = NULL , ylim = NULL , cex.axis = 0.8, element.color = "darkgray" , main = "Efficient Frontier" , RAR.text = "SR" , rf =0, tangent.line = TRUE , cex.legend =0.8 , chart.assets =TRUE , labels.assets =TRUE , pch.assets = 21, cex.assets = 0.8)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source