Locate the Rd sections in an Rd object and return a list of their positions and names.
1 2 3
an Rd object.
the name of a section, a character string. For builtin sections the leading backslash should be included.
Rdo_sections locates all sections at the top level in an Rd
object. This includes the predefined sections and the user defined
sections. Sections wrapped in
#ifdef directives are also found.
Rdo_sections returns a list with one entry for each section in
rdo. This entry is a list with components
"title" giving the position (suitable for use in
and the title of the section. For user defined sections the actual
name is returned, not "section".
The names of the sections are returned as single strings without attributes. The titles of predefined sections are single words but user defined sections may have longer titles and sometimes contain basic markup.
Rdo_locate_core_section works similarly but returns only the
results for section
sec. Currently it simply calls
Rdo_sections and returns only the results for
Note that for consistency
Rdo_locate_core_section does not
attempt to simplify the result in the common case when there is only
one instance of the requested section—it is put in a list of length
A list giving the positions and titles of the sections in
as described in 'Details'. The format is essentially that of
Rdo_locate, the difference being that field "value"
from that function is renamed to "title" here.
the position, a vector of positive integers,
a standard section name, such as
most of the core functionality was tested. Currently these functions
are underused—they can replace a number of internal and exported
Georgi N. Boshnakov
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
infile <- system.file("examples", "tz.Rd", package = "Rdpack") rd <- tools::parse_Rd(infile) ## Locate all top level sections in rd sections <- Rdo_sections(rd) ## How many sections there are in rd? length(sections) ## What are their titles? sapply(sections, function(x) x$title) ## The names of builtin sections include the backslash Rdo_locate_core_section(rd, "\\title") ## Locate a user defined secion Rdo_locate_core_section(rd, "Further information") ## The names of builtin sections include the backslash Rdo_locate_core_section(rd, "\\details") ## All appearances of the requested section are returned Rdo_locate_core_section(rd, "\\alias") Rdo_locate_core_section(rd, "\\keyword")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.