usage {document} | R Documentation |
Return the Usage of a Function From Within the Function
Description
Get a usage template for a function from within the function. If you encounter misguided usage, you can display the template.
Usage
usage(n = -1, usage = FALSE)
Arguments
n |
A negative integer giving the number of from to frames/environments
to go back (passed as |
usage |
Give this functions usage (as a usage example ...) and exit? |
Value
A character string giving the Usage as help
would do.
Examples
# usage with assignment operator:
foo <- function(x) {
u <- usage()
message("Usage is: ", u)
}
foo()
# usage without assignment operator:
bar <- function(x) {
message(usage(n = -2))
}
bar()
[Package document version 4.0.0 Index]