Devtools build_vignette cannot find functions

If I use devtools::use_vignette("my-vignette")in my package, it works devtools::build_vignette()fine.

However, as soon as I add a call to everything from my package, it stops working with an error could not find function "myfunc". If I add a call library(mypackage), I will get an error there is no package called 'mypackage'.

(I should note that my package checks, builds, and installs completely cleanly [without blame], and the launch is devtools::load_all()also great for interactive sessions.)

I know that if I create and install my package, I can create vignettes. It seems a truly ineffective and dangerous mode of development; essentially, forcing me to rebuild and reinstall the entire package with each commit, to verify that the vignette will not break.

Is there any other way to get the vignette to recognize the package in the process?

+4
source share
2 answers

If you use the RStudio IDE (which is very useful for developing the package), you can display your Rmd-document created using devtools::use_vignette, by clicking the Knit button . This will create a preview of your vignette. By the way, the RStudio IDE provides useful keys and buttons for executing your Rmd document block with a piece to check if it works.

If you are not using the RStudio IDE, you can create your document without creating a package using the function rmarkdown::render.

, , , . , , library(mypackage), .
devtools::install(build_vignette = FALSE). RStudio IDE Build & Reload enougth . `

- Rstudio IDE devtools::load_all(path to your package) , . devtools::build vignette, .

, , . , , devtools::load_all library, .

+6

Hadley Wickham github, , (xyz) , , https://github.com/tidyverse/dplyr/blob/master/vignettes/dplyr.Rmd

:

*devtools::build_vignettes()*, . devtools::build() .

, , , CRAN.

, devtools::load_all() devtools::load_all() RStudio.

+3

All Articles