Rdpack (version 0.4-20)

parse_pairlist: Parse formal arguments of functions

Description

Parse formal arguments of functions and convert them to f_usage objects.

Usage

parse_pairlist(x)
pairlist2f_usage1(x, name, S3class = "", S4sig = "", infix = FALSE, fu = TRUE)

Arguments

x
a pairlist or a list of pairlists, see `Details'.
name
function name.
S3class
S3 class, see `Details'
S4sig
S4 signature, see Details.
infix
if TRUE the function usage is in infix form, see Details.
fu
if TRUE the object is a function, otherwise it is something else (e.g. a variable or a constant like pi and Inf).

Value

For parse_pairlist, a list with the following components:For pairlist2f_usage1, an object with S3 class "f_usage". This is a list as for parse_pairlist and the following additional components:

Details

These functions are mostly internal.

x is a single pairlist object for parse_pairlist and pairlist2f_usage1.

The pairlist object is parsed into a list whose first component contains the names of the arguments. The second component is a named list containing the default values, converted to strings. Only arguments with default values have entries in the second component (so, it may be of length zero).

pairlist2f_usage1 adds components name (function name), S3class, S4sig and infix. S3class is set for S3 methods, S4sig is the signature of an S4 method (as used in Rd macro \S4method). infix is TRUE for the rare occations of usages of infix operators. The result is given class "f_usage". This class has a method for as.character which generates a text suitable for inclusion in Rd documentation.

See Also

promptUsage

Examples

Run this code
parse_pairlist(formals(lm))

Run the code above in your browser using DataLab