knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
rd2list
is a package for extracting R documentation into a structured,
human-readable list. Use this package if you've ever wanted to get the help text for a function as a string.
get_doc()
- get a structured, human-readable list of the documentation for a function.get_rd_doc()
- fetch the Rd object for a function from an installed package.rd2list()
- parse an Rd object into a structured, human-readable list.You can install from github with:
remotes::install_github("coolbutuseless/rd2list")
doc <- rd2list::get_doc(function_name = 'geom_path', package = 'ggplot2') doc$title
doc$description
# Jumping through some hoops. must be an easier way... cat(paste(strwrap(doc$description), collapse="\n"))
doc$arguments$linejoin
doc$alias
The raw Rd documentation object can be fetched using get_rd_doc()
.
rd2list::get_rd_doc(function_name = 'diag', package_name = 'base')
$title $title[[1]] [1] "Matrix Diagonals" attr(,"Rd_tag") [1] "TEXT" attr(,"Rd_tag") [1] "\\title" $name $name[[1]] [1] "diag" attr(,"Rd_tag") [1] "VERB" attr(,"Rd_tag") [1] "\\name" $alias $alias[[1]] [1] "diag" attr(,"Rd_tag") [1] "VERB" attr(,"Rd_tag") [1] "\\alias" [... output trimmed]
Rd
format.fgui::parseHelp()
used to work, but has been disabled by author.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.