使用roxygen2文档未找到数据

6

我正在使用 roxygen2 库和 devtools。构建一个具有以下结构的软件包:

  • Inside /data folder I have two .rda files with the information of each dataset. Let's call them data1.rda and data2.rda.
  • Inside /R folder I have two files, one with the functions created (and their explanation) and another one called data.R with the information of each dataset.

    #' Description 1
    #'
    #' Simple definition
    #'
    #' @format The \code{data.frame} contains 2 variables:
    #' \describe{
    #'   \item{a}{The first variable.}
    #'   \item{b}{The second variable.}
    #' }
      "data1"
    

当我运行 roxygen2::roxygenize() 时,出现以下消息:

首次使用roxygen2。自动升级... 错误:在环境中未找到对象"data1"。

我已经寻找了类似的问题,但没有答案解决这个问题。有人有建议吗?


如果你在#'块的末尾添加@keywords data,它是否有效? - Paolo
你的实际Roxygen注释中是否有空行? - Dason
通常在roxygen文档中的数据集部分,我们不是直接使用NULL吗?如果这样做,它能正常工作吗? - Dason
2
https://dev59.com/eHE95IYBdhLWcg3wb9db - Dason
@Dason 谢谢,按照推荐的链接做法成功了。奇怪的是,http://blog.runsheng.xyz/attachment/r-packages.pdf 中指示的传统方法不起作用。 - R18
显示剩余10条评论
3个回答

4

这可能是个愚蠢的问题,但你是否在你的已加载的包上运行了roxygenise?也就是说,你首先要运行devtools::load_all(),然后再运行roxygen2::roxygenise()

我在其他文章中看到过一些人犯这个错误。


0
请尝试在您的注释中添加以下附加标签:@name,@docType@references

0

roxygen2::roxygenize 方法无法正确加载包。但是,您可以使用 devtools::document(package_path) 替换此步骤。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接