2011-04-25 67 views
1

roxygenize在以下代碼上失敗並顯示以下錯誤消息。關於這個主題的其他帖子表明有一個錯位的字符。我找不到任何錯誤!你能發現這個問題嗎?如果我拿出從長@return線變量名僅限於256字節

EDIT2
的roxygenize調用之前()結果添加sessionInfo幾句

#' My Title. My Description 
#' 
#' @return A n x n \code{\link{matrix}} where n = the number of variables. Row and column names are in the same order and are equivalent to the variable names in \samp{timeSeriesData}. Each entry [i,j] in the matrix is the covariance between variable i and variable j. 
#' @callGraphPrimitives 
#' @note some notes here 
MyFunc = function(timeseriesData , method , decayFactor ) 
{ 
} 


Error in do.call(paste, c(trimmed.lines, sep = "\n")) : 
    variable names are limited to 256 bytes 
Calls: roxygenize ... parse.ref.list -> append -> parse.ref -> parse.ref.preref 
-> do.call 
Execution halted 

EDIT1
上面的代碼工作得很好。

R version 2.12.2 (2011-02-25) 
Platform: i386-pc-mingw32/i386 (32-bit) 

locale: 
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252 
[3] LC_MONETARY=English_United States.1252 
[4] LC_NUMERIC=C 
[5] LC_TIME=English_United States.1252 

attached base packages: 
[1] stats  graphics utils  datasets grDevices methods base 

other attached packages: 
[1] roxygen_0.1-2 digest_0.4.2 
+1

這種運行沒有我的機器上的任何錯誤。 'sesionInfo()'的結果是什麼? – Andrie 2011-04-25 22:00:27

+0

我在roxygenize調用之前發佈了sessionInfo。在roxygenize調用後我無法讓它工作,因爲執行暫停。請注意,如果從@return行的末尾取出幾個單詞,原始代碼可以正常工作。 – SFun28 2011-04-25 22:10:23

+0

這是一個猜測:'@ return'參數限制爲256個字符。也許我過去遇到過同樣的問題,因爲通常我的'@ return'包含像'@return data.frame'這樣的最簡單的東西。相反,我傾向於使用roxygen描述來擴展機制和輸出。僅供參考,您缺少'@ param'調用 - 如果您打算在包中使用此函數,那麼如果您的@參數和函數參數不匹配,R CMD檢查將會失敗。 – Andrie 2011-04-25 22:34:43

回答

6

這是一個已知的錯誤:看到this discussion涉及哈德利韋翰,一個貢獻者roxygen。

該工作輪次爲較短的行數:您的#' @return A n x n ...行大約有270個字符(包括三個句子),因此可以輕鬆拆分。

+1

+1尼斯鏈接。謝謝。 – Andrie 2011-04-25 22:43:20

+0

+1。當你說「分裂」時,你的意思是我可以保留內容並將其分割成多行? – SFun28 2011-04-25 22:51:37

+0

忽略...如果我分成多行,則可以工作 – SFun28 2011-04-25 22:54:19

2

其他可能的解決方案是升級到R2.13.0,現在你的字符長度有10.000一個最大值,而不是256