knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

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
doc$description
# Jumping through some hoops. must be an easier way...
cat(paste(strwrap(doc$description), collapse="\n"))
doc$arguments$linejoin
doc$alias

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.