0

我正在尝试从 R-Forge 中找出“factorAnalytics”包。一切似乎都可以正常加载,但是当我尝试浏览示例时,我无法加载数据。

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

这工作正常,一切都已安装。我现在尝试浏览小插图中的示例:

# 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)

它提供了这个:

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

但是如果我运行这个:

data(package = "factorAnalytics")

我看到数据集应该在那里......

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

那我错过了什么??

4

2 回答 2

0

你可以这样尝试:

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

您应该找到“Stock.df.RData”所在的路径。

于 2016-09-02T09:56:13.733 回答
0

我是一个白痴。安装软件包后我没有包含该库。对不起大家。

我刚刚跑了这个:

library("factorAnalytics")
于 2016-05-03T12:58:11.313 回答