[R-pkg-devel] Load data inside .Rd documentation file inside the item-field?

Vincent van Hees v|ncentv@nhee@ @end|ng |rom gm@||@com
Tue May 3 11:50:09 CEST 2022


Dear list,

Is it possible in .Rd documentation to load and use data inside an
item-field like we can integrate R data in text in R markdown files?

Something along the lines of:
\item{max}{
  Numeric, default value = `R max`, controls the upper limit of the plot.
}
where `R max` resolves into the actual default value.

I am guessing this is not possible, but it would be great if someone could
either confirm or point me to the actual way to do this.

Full story with clarification for why I am trying to do this:
The R package I maintain has a function that acts as a data processing
pipeline with over a hundred configuration arguments. Given that it is bad
practice to write a function with this number of input arguments, I use
parameter objects that hold sets of arguments. These objects are then
passed on to the pipeline function. The default values for the parameter
objects are stored in a separate function load_params() that aids in
loading the defaults. Although it makes the code a lot easier to navigate,
it also means that the user will no longer find default argument values in
the standard package documentation.

As a solution I can write a package vignette that loads and displays all
the default argument values. However, for those more oriented towards using
the ? command to get help about the function, it would be nice if the same
default arguments values are also shown in the package documentation, being
the .Rd files accessed via .pdf or with ? in R.

Thanks, Vincent

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list