Show function arguments in a human-readable way - get a call tip

Share:

Description

argsTip() displays function arguments in a better way than args() does. It is primarily intended for code tips in GUIs.

Usage

1
2
3
argsTip(name, only.args = FALSE, width = getOption("width"))
callTip(code, only.args = FALSE, location = FALSE, description = FALSE,
    methods = FALSE, width = getOption("width"))

Arguments

name

a string with the name of a function.

code

a fraction of R code ending with the name of a function, eventually followed by '('.

only.args

do we return only arguments of the function (arg1, arg2 = TRUE, ...), or the full call, like (myfun(arg1, arg2 = TRUE, ...)).

width

reformat the tip to fit that width, except if width = NULL.

location

if TRUE then the location (in which package the function resides) is appended to the calltip between square brackets.

description

if TRUE then a short description of the function is added to the callTip (in fact, the title of the corresponding help page, if it exists).

methods

if TRUE then a short message indicating if this is a generic function and that lists, in this case, available methods.

Value

A string with the calling syntax of the function, plus additional information, depending on the flag used. Note that methods can considerably slow down the execution, especially for generic functions that have many methods like print(), or summary!

Note

argsTip() is supposed to display S3 and S4 methods, and primitives adequately,... but this is not implemented yet in the current version!

Author(s)

Philippe Grosjean <phgrosjean@sciviews.org>

See Also

args, argsAnywhere

Examples

1
2
argsTip("ls")
callTip("myvar <- lm(")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.