Rdo_get_args: Extract argument description from a help topic

View source: R/Rdutils.R

Rdo_get_argsR Documentation

Extract argument description from a help topic

Description

Extract argument description from a help topic.

Usage

Rdo_get_args(rd, args, ...)
Rdo_get_arg(rd, arg)

Arguments

rd

the documentation for the topic, typically an Rd object but may be anything that Rd_fun accepts.

arg

an argument name, a string

args

names of arguments to describe, a character vector, see also Details section

...

not used

Details

If arguments is missing, descriptions of all arguments are returned.

Effort is made to handle the case when two or more arguments are described in a single entry. In that case it is not possible to disentangle the description automatically. So, the description is returned as is. Also, only one copy of the description is returned, see the examples with the from and to arguments of function seq.

The ... argument is handled, as well, give it as the string ⁠...⁠ in args.

Rdo_get_arg simply calls Rdo_get_args and returns the first element of its value. This means that arg is expected to be of length one, but this is not enforced. Note also that Rdo_get_arg is not completely equivalent to calling Rdo_get_args with length(args)=1.

Value

For Rdo_get_args, an Rd fragment representing the (part of) help section ⁠\arguments⁠ containing descriptions of the requested arguments.

For Rdo_get_arg an Rd fragment representing the help for a single argument.

Author(s)

Georgi N. Boshnakov

Examples

h1 <- help("seq")
Rdo_get_args(h1)
Rdo_get_args(h1,"by")
Rdo_get_args(h1,"length.out")
Rdo_get_args(h1,"...")
Rdo_get_args(h1,"from")
Rdo_get_args(h1,c("from","by"))
Rdo_get_args(h1,c("from", "to"))

Rdo_get_args("seq")
Rdo_get_args("seq","by")
Rdo_get_args("seq","length.out")
Rdo_get_args("seq","...")
Rdo_get_args("seq","from")
Rdo_get_args("seq",c("from","by"))
Rdo_get_args("seq",c("from", "to"))

gbRd documentation built on June 22, 2024, 11:34 a.m.