简体   繁体   中英

How do I rebuild data-raw using roxygen2?

I have a package that uses a pre-built dataset that may be modified over time by other parts of the package. Specifically, I have files that I add to the inst directory that will be indexed to make a data.frame. The indexing does not take a very long time (about 15-30 seconds), but it is longer than something I'd like to do on every package load.

Is there a way to automate the indexing so that it will occur with roxygen2::roxygenize() ? What I'd really love to have happen is that an R function from the package would run any time I run devtools::document() . I think that this is possible by creating a custom roclet, but I don't understand quite how I would do this in practice.

After reading more documentation, I found the answer to the question. The @examples idea from @r2evans helped me find something that is more directly targeting something like this. I used #' @eval my_function() where my_function() is an exported function in the package that builds the data and generates the documentation for the data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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