0

I am using roxygen2 to document my package, however, I cannot use \dontrun to avoid running my example code. Here's what I have done:

#' @examples \dontrun {
#'  x <- myfunc()
#' }

when W use roxygenize to generate the docuemnt, and use ?myfunc to see the actual document, I found the following message on the popup browser window:

Error in fetch(key) : lazy-load database '' is corrupt

And when I rerun roxygenize with @examples completely removed, I got the following message in R terminal:

Warning message: In fetch(key) : internal error -3 in R_decompress1

Any idea how I could fix this? many thanks

NelsonGon
  • 13,015
  • 7
  • 27
  • 57
yuez
  • 885
  • 1
  • 8
  • 16
  • 1
    I haven't looked into the reason of this error, but for me restarting R always helps here. – Gabor Csardi Aug 06 '14 at 16:38
  • @GaborCsardi I see what you mean. Seems I need to restart R many times to get the documentation right ... – yuez Aug 06 '14 at 18:02
  • I would start the `\dontrun{` on the line *below* the one containing `@examples`. – Gavin Simpson Aug 06 '14 at 21:19
  • @GavinSimpson That does not fix the error, of course. :) The error happens if you opened a manual page, and then reinstall the package, and it does not always happen, some strange timing of these events is required as well. Or something like this, maybe a broken `R CMD INSTALL` is needed, too. But it happens quite often actually, and it is very annoying. I have already seen it from the console, from Emacs ESS and RStudio as well. – Gabor Csardi Aug 07 '14 at 04:26
  • Oh @GaborCsardi that happens frequently for me if I've updated a package whilst R is running elsewhere with that package in use. I can see now how to OP might be running into this if they are running one version of pkg and installing a newer version. – Gavin Simpson Aug 07 '14 at 04:44
  • 1
    @GavinSimpson: the really annoying thing is that even if you unload the package, and load the new version, it does not fix the help system. Next time I'll have a free hour I'll go and fix this. :) I guess I have already wasted a day's time from my life in those R restarts. – Gabor Csardi Aug 07 '14 at 04:58
  • In case you come here wondering why `\dontrun` is not recognized, I did fix it by making sure `@examples` was well aligned with other tags. The issue was that I had a trailing whitespace before some tags. – NelsonGon Jul 29 '19 at 08:40

0 Answers0