get_usage_text: Get the text of the usage section of Rd documentation

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/manip.R

Description

Get the text of the usage section of Rd documentation.

Usage

1

Arguments

rdo

an Rd object or a character string

Details

If rdo is a string, it is parsed to obtain an Rd object.

The content of section "\usage" is extracted and converted to string.

Value

a string

Note

todo: get_usage_text can be generalised to any Rd section but it is better to use a different approach since print.Rd() does not take care for some details (escaping %, for example). Also, the functions that use this one assume that it returns R code, which may not be the case if the usage section contains Rd comments.

Author(s)

Georgi N. Boshnakov

Examples

1
2
3
4
5
6
7
## get the Rd object documenting Rdo_macro
#h <- utils::help("Rdo_macro", lib.loc = .libPaths())
#rdo <- utils:::.getHelpFile(h)
rdo <- Rdo_fetch("Rdo_macro", "Rdpack")
# extract the usage section and print it:
ut <- get_usage_text(rdo)
cat(ut, sep = "\n")

GeoBosh/Rdpack documentation built on Oct. 29, 2018, 8:22 p.m.