Parse the documentation for a function and save the working examples to an R
script. Note that the f
argument is parameterized and can handle multiple
requests in a single call.
Usage
saveRdExamples(rd = NULL, package, dir = getwd())
Arguments
- rd
character
orNULL
. R documentation name(s) from which to parse and save the working examples. IfNULL
, all documentation files containing examples will be saved.- package
character(1)
. Package name.- dir
character(1)
. Directory path.
Examples
dir <- file.path(tempdir(), "testdata")
out <- saveRdExamples(
rd = c("do.call", "droplevels"),
package = "base",
dir = dir
)
#> Saved 2 Rd examples from base to '/private/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T/RtmpQDnHHO/testdata'.
print(out)
#> do.call
#> "/private/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T/RtmpQDnHHO/testdata/do.call.R"
#> droplevels
#> "/private/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T/RtmpQDnHHO/testdata/droplevels.R"
unlink(dir, recursive = TRUE)