2017-06-21 91 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上的軟件包,您需要完成所有必需的參數和說明。

相關問題