[R] Code Help

Joshua Wiley jwiley.psych at gmail.com
Sun Jul 10 22:48:29 CEST 2011


On Sun, Jul 10, 2011 at 12:32 PM, finguy <bball3brian at hotmail.com> wrote:
> Am I missing a Package? I'm not sure why is won't read the functions. Any

That is the implication, yes.  To find out which one (though one
wonders how you got this code without knowing the packages it runs
on), you can use the findFn() function from the sos package.  If you
do not have the sos package already:

install.packages("sos")
require(sos) # load it
findFn("portfolioSpec")

suggests that the package you are looking for (at least initially) is
"fPortfolio".  You can repeat the above search process as needed if
that does not solve the rest of your missing function problems.

Cheers,

Josh


> help is much appreciated.
>
>> PData = Data[,3:10]
>> Spec = portfolioSpec()
> Error: could not find function "portfolioSpec"
>> setTargetReturn(Spec) = mean(colMeans(PData))
> Error in setTargetReturn(Spec) = mean(colMeans(PData)) :
>  object 'Spec' not found
>> Constraints = "LongOnly"
>> efficientPortfolio(PData, Spec, Constraints)
> Error: could not find function "efficientPortfolio"
>> Frontier = portfolioFrontier(PData)
> Error: could not find function "portfolioFrontier"
>> frontierPlot(Frontier, col = c("orange", "orange"), pch = 19)
> Error: could not find function "frontierPlot"
>> minvarport = minvariancePoints(Frontier, pch = 19, col = "red")
> Error: could not find function "minvariancePoints"
>> minvariancePortfolio(PData)
> Error: could not find function "minvariancePortfolio"
>> cmlp = tangencyPoints(Frontier, pch = 19, col = "blue")
> Error: could not find function "tangencyPoints"
>> cml = tangencyLines(Frontier, col = "blue")
> Error: could not find function "tangencyLines"
>> tangencyPortfolio(PData)
> Error: could not find function "tangencyPortfolio"
>> ew = equalWeightsPoints(Frontier, pch = 15, col = "green")
> Error: could not find function "equalWeightsPoints"
>> sap = singleAssetPoints(Frontier, pch = 25, cex = 2.0, col =
>> topo.colors(8))
> Error: could not find function "singleAssetPoints"
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Code-Help-tp3658106p3658106.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
https://joshuawiley.com/



More information about the R-help mailing list