README.md

rd2list

AppVeyor build
status Travis build
status Coverage
status

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.

Installation

You can install from github with:

remotes::install_github("coolbutuseless/rd2list")

Example - Getting documentation as a list

doc <- rd2list::get_doc(function_name = 'geom_path', package = 'ggplot2')

doc$title
#> [1] "Connect observations"
doc$description
#> `geom_path()` connects the observations in the order in which they
#> appear in the data. `geom_line()` connects them in order of the
#> variable on the x axis. `geom_step()` creates a stairstep plot,
#> highlighting exactly when changes occur. The `group` aesthetic
#> determines which cases are connected together.
doc$arguments$linejoin
#> [1] "Line join style (round, mitre, bevel)."
doc$alias
#> [1] "geom_path" "geom_line" "geom_step"

Example - Getting documentation as an Rd object

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]

Related documents and packages:



coolbutuseless/rd2list documentation built on May 20, 2019, 9:41 a.m.