Replace or modify parts of Rd objects.
1 2 3
an Rd object.
an Rd fragment.
if TRUE, create a new section, see ‘Details’.
a logical, if TRUE
a logical, if TRUE examine also the "Rd_tag" of
rdo is an Rd object (complete or a fragment) to be
val is an Rd fragment to use for modification.
val is appended to (if
replace is FALSE) or
replace is TRUE) the content of an element of
rdo which has the same "Rd_tag" as
top specifies whether to check the "Rd_tag" of
rdo itself, see below.
Here are the details.
top is TRUE and
val have the same
(non-NULL) "Rd_tag", then the action depends on
create is ignored in this case).
replace is TRUE,
val is returned. Otherwise
val are, effectively, concatenated. For example,
rdo may be the "arguments" section of an Rd object and
val may also be an "arguments" section containing new
Otherwise, an element with the "Rd_tag" of
val is searched in
tools:::RdTags(). If such elements are found,
the action again depends on
replace is a character string, then the first element of
rdo that is a list whose only element is identical to the
replace is replaced by
val. If such an
element is not present and
create is TRUE,
create is FALSE,
rdo is not
replace is TRUE, the first element found is replaced with
replace is FALSE,
val is appended to the first
If no element with the "Rd_tag" of
val is found the action
create is TRUE, then
is inserted in
rdo, effectively creating a new section. If
create is FALSE, an error is thrown.
Rdo_replace_section is like
Rdo_modify with argument
top fixed to TRUE and the default for argument
set to TRUE. It hardly makes sense to call
replace = FALSE but a character value for it may be
handy in some cases, see the examples.
an Rd object or fragment, as described in ‘Details’
Georgi N. Boshnakov
1 2 3 4 5
# a <- tools::parse_Rd("./man/promptUsage.Rd") # char2Rdpiece("documentation", "keyword") # this changes a keyword from Rd to documentation # Rdo_replace_section(a, char2Rdpiece("documentation", "keyword"), replace = "Rd")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.