Convert a character vector to Rd piece

Share:

Description

Convert a character vector to Rd piece.

Usage

1
char2Rdpiece(content, name, force.sec = FALSE)

Arguments

content

a character vector.

name

name of an Rd macro, a string.

force.sec

TRUE or FALSE, see ‘Details’.

Details

Argument content is converted to an Rd piece using name to determine the format of the result.

The Rd tag of content is set as appropriate for name. More specifically, if name is the name of a macro (without the leading '\') whose content has a known "Rdtag", that tag is used. Otherwise the tag is set to "TEXT".

If force.sec is TRUE, name is treated as the name of a top level section of an Rd object. A top level section is exported as one argument macro if it is a standard section (detected with is_Rdsecname) and as the two argument macro "\section" otherwise.

If force.sec is FALSE, the content is exported as one argument macro without further checks.

Note

This function does not attempt to escape special symbols like ‘%’.

Author(s)

Georgi N. Boshnakov

Examples

1
2
3
4
5
6
7
8
# add a keyword section
char2Rdpiece("graphics","keyword")

# an element suitable to be put in a "usage" section
char2Rdpiece("log(x, base = exp(1))", "usage")

#
char2Rdpiece("Give more examples for this function.", "Todo", force.sec = TRUE)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.