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

Gábor Csárdi c@@rd|@g@bor @end|ng |rom gm@||@com
Tue May 3 15:53:45 CEST 2022


You can also do this with roxygen2:
https://roxygen2.r-lib.org/articles/rd-formatting.html#inline-code

It runs when you are generating the manual pages, for better or worse.

Gabor

On Tue, May 3, 2022 at 11:51 AM Vincent van Hees
<vincentvanhees using gmail.com> wrote:
>
> 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]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list