[Rd] Parametrized Vignettest in R packages

Duncan Murdoch murdoch@dunc@n @ending from gm@il@com
Mon Jul 9 21:32:38 CEST 2018

On 09/07/2018 3:24 PM, Witold E Wolski wrote:
> Dear Yihui,
> Thank you for the valuable questions.
> sample_analysis is a "tibble" while
> configuration is an "R6" class.
> But I also have parametrized reports where I pass R reference classes
> as arguments.
> This is the Rmd yaml params part corresponding to the error message.
> params:
>    configuration:  !r get(data(skylineconfig))
>    data: !r get(data(sample_analysis))
> Might the R6 class which I pass to  configuration the source of the
> problem here? I have heard somewhere that R6 uses environments to
> implemented some features.
> There is also a further problem I am encountering reproducible when
> running devtools::install() or R CMD INSTALL
> ** installing vignettes
>     'tr_srm_summary.Rmd' using 'UTF-8'
> Warning in data(skylineconfig) : data set 'skylineconfig' not found
> Error in get(data(skylineconfig)) : object 'skylineconfig' not found

You likely need to specify the package name, e.g.

data("skylineconfig", package = "yourpackage")

Also see my suggestion to use quote() to delay evaluation:

> params:
>    configuration:  !r quote(get(data(sample_analysis)))
> in the YAML will set configuration to the expression needed to get the 
> environment;
>      eval(params$configuration)

Duncan Murdoch

More information about the R-devel mailing list