2017-06-21 92 views
3

我已经安装了下面的类在我的定制[R包警告:为什么devtools给我@slot需要的名称和说明

#' A stock.returns class is an xts of stock(s) returns, a timeframe and the currency used. 
#' 
#' @slot xts_returns An xts of stock returns (potentially multiple stocks) 
#' @slot timeframe 
#' @slot currency Any three letter currency, or "Local" 
#' @include timeframe.R 
#' @export 
stock.returns <- setClass(
    Class = "stock.returns", 
    slots = c(xts_returns = "xts", timeframe = "timeframe", currency = "character"), 
    prototype = prototype(xts_returns = xts::xts(, order.by = c(lubridate::today())), timeframe = timeframe(), currency = "Local") 
) 

#' A stock.returns class is an xts of stock(s) returns, a timeframe and the currency used. 
#' 
#' @param timeframe 
#' @param benchmark_code The code for the index of stocks you want the returns for. 
#' @param portfolio_code The code for the portfolio of stocks you want the returns for. 
#' @param sec_id_list An explicit list of sec_id's you want the returns for. 
#' @param currency Any three letter currency, or "Local". The default is "AUD". 
#' @export 
stock.returns <- function(
    timeframe, benchmark_code, portfolio_code, sec_id_list, currency = "AUD") { 
     # ... code goes here ... 
} 

当我运行devtools::document自动生成我.Rd文件,为什么我会收到以下警告?

Warning: 
@slot [stock.returns.R#16]: requires name and description 
Warning: 
@param [stock.returns.R#28]: requires name and description 
+1

你的'@slot timeframe'没有描述,也没有'@param timeframe',并且警告告诉你这些参数'需要一个名称和描述' – SymbolixAU

+0

@SymbolixAU就是这样!谢谢,我现在感觉有点傻了 – lebelinoz

+1

我已经有很多次这个警告:) – SymbolixAU

回答

3

记录的功能参数需要名称和说明。

在你的代码中,@slot timeframe@param timeframe只有名字组成部分,他们需要一个描述太(就像所有其它参数)

这不会影响到/从建筑或安装停止包,但要获得CRAN上的软件包,您需要完成所有必需的参数和说明。

相关问题