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())
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/9b/4gh0pghx1b71jjd0wjh5mj880000gn/T/RtmpzroEwl/testdata'.
print(out)
#> do.call
#> "/private/var/folders/9b/4gh0pghx1b71jjd0wjh5mj880000gn/T/RtmpzroEwl/testdata/do.call.R"
#> droplevels
#> "/private/var/folders/9b/4gh0pghx1b71jjd0wjh5mj880000gn/T/RtmpzroEwl/testdata/droplevels.R"
unlink(dir, recursive = TRUE)