Skip to content
Prev 847 / 12125 Next

[R-pkg-devel] Getting a package ready for CRAN - some questions

If it's not feasible to create a fast vignette or to avoid downloading
files, an alternative is to pre-generate the vignette and include it
as a static PDF/HTML vignette, cf.
https://cran.r-project.org/package=R.rsp.  If it's a LaTeX-based
vignette (e.g. Sweave/knitr), you could pre-generate the LaTeX
document and any figures and the use a plain-LaTeX vignette to include
it in the package (also supported by the R.rsp package).  For
reproducibility, I would include the root/source vignette in the
package as well, e.g. in inst/full-vignettes/ with instructions and/or
a function on how to rebuild it.

I second Hadley's recommendation on adjusting it such that you don't
depend on deprecated/archived CRAN packages (unless there is a plan
for that package to reappear on CRAN any time soon).


Berry, it sounds like you're caching computational expensive results
on file such that succeeding runs will load the cached results instead
of redoing them from scratch each time.  This sounds like a perfectly
fine solution to me.  To me it would be fine to also include that
cached file in the package itself (e.g. inst/cache/) so that it is
picked up also the first time the vignette is built.  You can make it
conditional on a system environment variable such that it is possible
to build it completely from scratch, e.g.

if (Sys.getenv("_R_VIGNETTE_FULL_") != "TRUE") {
  # Load cached data here
}

Some may argue that you're package is not fully tested this way, but
that depends on how well your package tests/ are written.  I tend to
look at examples() and vignettes as demos, and tests/ as actually
tests.  All should of course pass R CMD check and run, but the tests/
are what really test the package.

/Henrik

On Wed, Jun 1, 2016 at 2:01 AM, Berry Boessenkool
<berryboessenkool at hotmail.com> wrote: