变量名限制为 256 字节

发布于 2024-11-03 10:20:52 字数 1302 浏览 5 评论 0原文

roxygenize 在执行以下代码时失败,并显示以下错误消息。关于此主题的其他帖子表明存在错误的字符。我找不到什么不妥的地方!你能发现问题所在吗?

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

编辑1
如果我从长@return行中取出几个单词

Edit2
, 上面的代码就可以正常工作 在 roxygenize 调用之前添加 sessionInfo() 结果。

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

roxygenize is failing on the following code with the following error message. Other posts on this topic indicate that there's a misplaced character. I can't find anything wrong! Can you spot the issue?

#' 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
The above code works just fine if I take out a few words from the long @return line

Edit2
Adding sessionInfo() results before the roxygenize call.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

獨角戲 2024-11-10 10:20:52

这是一个已知的错误:请参阅此讨论,涉及 roxygen 的贡献者 Hadley Wickham。

解决方法是缩短行数:您的 #' @return A nxn ... 行包含大约 270 个字符(包括三个句子),因此可以轻松拆分。

This is a known bug: see this discussion involving Hadley Wickham, a contributor to roxygen.

The work-round is to have shorter lines: your #' @return A n x n ... line has about 270 characters (including three sentences) in it, so could easily be split.

很快妥协 2024-11-10 10:20:52

另一种可能的解决方案是升级到 R2.13.0,现在字符长度的最大值为 10.000 而不是 256

The other possible solution is upgrading to R2.13.0, now your character length has a max value of 10.000 instead of 256

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文