I cannot load data from R package from R-Forge

328 Views Asked by At

I am trying to figure out the 'factorAnalytics' package from R-Forge. Everything seems to load fine, but when i try to walk through an example, I cannot load the data.

install.packages("factorAnalytics", repos="http://R-Forge.R-project.org")

This works fine and everything is installed. I now try to walk through the example in the vignette:

# Load fundamental and return data
data(Stock.df)

# fit a fundamental factor model
exposure.vars <- c("BOOK2MARKET", "LOG.MARKETCAP")
fit <- fitFfm(data=stock, asset.var="TICKER", ret.var="RETURN", 
              date.var="DATE", exposure.vars=exposure.vars)
names(fit)

Which provides this:

Warning message:
In data(Stock.df) : data set ‘Stock.df’ not found

But if I run this:

data(package = "factorAnalytics")

I see that the dataset should be there...

Data sets in package ‘factorAnalytics’:

factors.M (CommonFactors)         Factor set of several commonly used factors
factors.Q (CommonFactors)         Factor set of several commonly used factors
managers                          Hypothetical Alternative Asset Manager and Benchmark Data
r.M (StockReturns)                Stock Return Data
r.W (StockReturns)                Stock Return Data
stock (Stock.df)                  Fundamental and return data for 447 NYSE stocks
tr.yields (TreasuryYields)        Treasury yields at different maturities

So what am I missing??

2

There are 2 best solutions below

0
On

I am an idiot. I did not include the library after installing the package. Sorry all.

I just ran this:

library("factorAnalytics")
0
On

You can try like this:

    load("E:\\R-3.3.1\\library\\factorAnalytics\\data\\Stock.df.RData")

You should find the path where "Stock.df.RData" is.