Learn R Programming

Rdpack (version 0.4-4)

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).

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 ## S3 method for class 'names of arguments, a character vector': \item{argnamesundefined 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. For parse_pairlist, a list with the following components: argnames{names of arguments, a character vector} defaults{a named character vector containing the default values, converted to character strings.} For pairlist2f_usage1, an object with S3 class "f_usage". This is a list as for parse_pairlist and the following additional components: name{function name, a character string.} S3class{S3 class, a character string.} S4sig{S4 signature.} infix{a logical value, TRUE for infix operators.} [object Object] promptUsage parse_pairlist(formals(lm))RdoBuild