parse_Rdtext: Parse Rd source text as the contents of a section

Description Usage Arguments Details Value Note Author(s) See Also

View source: R/parse.R


Parse Rd source text as the contents of a given section.


parse_Rdtext(text, section = NA)



Rd source text, a character vector.


the section name, a string.


If section is given, then parse_Rdtext parses text as appropriate for the content of section section. This is achieved by inserting text as an argument to the TeX macro section. For example, if section is "\usage", then a line "\usage{" is inserted at the begiinning of text and a closing "}" at its end.

If section is NA then parse_Rdtext parses it without preprocessing. In this case text itself will normally be a complete section fragment.


an Rd fragment


The text is saved to a temporary file and parsed using parse_Rd. This is done for at least two reasons. Firstly, parse_Rd works most reliably (at the time of writing this) from a file. Secondly, the saved file may be slightly different (escaped backslashes being the primary example). It would be a nightmare to ensure that all concerned functions know if some Rd text is read from a file or not.

The (currently internal) function .parse_Rdlines takes a character vector, writes it to a file (using cat) and calls parse_Rd to parse it.


Georgi N. Boshnakov

See Also


Rdpack documentation built on May 19, 2017, 10:33 a.m.

Search within the Rdpack package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.