简体   繁体   English

使用roxygen2的文档中找不到数据

[英]Data not found in documentation with roxygen2

I am working with roxygen2 library and devtools . 我正在使用roxygen2库和devtools Building a package with the following structure: 构建具有以下结构的包:

  • Inside /data folder I have two .rda files with the information of each dataset. 内部/数据文件夹我有两个.rda文件,其中包含每个数据集的信息。 Let's call them data1.rda and data2.rda . 我们称它们为data1.rdadata2.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. Inside / R文件夹我有两个文件,一个是创建的函数(及其解释),另一个是data.R ,包含每个数据集的信息。

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

When I run roxygen2::roxygenize() I get this message: 当我运行roxygen2::roxygenize()我收到此消息:

First time using roxygen2. 第一次使用roxygen2。 Upgrading automatically... Error in get(name, envir = env) : object 'data1' not found. 自动升级... get(name,envir = env)中的错误:找不到对象'data1'。

I have looked for similar questions, without an answer for this problem. 我找了类似的问题,但没有回答这个问题。 Anyone has a suggestion? 有人有建议吗?

It might be a silly question but are you running roxygenise on your loaded package? 这可能是一个愚蠢的问题,但你在加载的包装上运行roxygenise? Meaning that you first run devtools::load_all() , and then roxygen2::roxygenise() . 这意味着你首先运行devtools::load_all() ,然后运行roxygen2::roxygenise() I've seen a couple of people making this mistake on other posts. 我看到有几个人在其他帖子上犯了这个错误。

The roxygen2::roxygenize method does not load the package properly. roxygen2::roxygenize方法无法正确加载包。 But you can replace this step with devtools::document(package_path) 但你可以用devtools::document(package_path)替换这一步

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM