R/argsTip.R

Defines functions argsTip

Documented in argsTip

argsTip <- function (name, only.args = FALSE, width = getOption("width"))
{
	## TODO: handle primitives and S3/S4 methods for generic functions
	ret <- try(res <- eval(parse(text = paste("argsAnywhere(", name, ")",
		sep = ""))), silent = TRUE)
	if (inherits(ret, "try-error") || is.null(res))
		return("")  # Function 'name' not found
	res <- deparse(res)
	res <- paste(res[-length(res)], collapse = "\n")
	if (isTRUE(only.args)) {
		res <- sub("^function *[(]", "", res)
		res <- sub(" *[)] *$", "", res)
	} else {
		res <- sub("^function *", name, res)
		res <- sub(" *$", "", res)
	}
	## Reflow the tip
	if (!is.null(width))
		res <- paste(strwrap(res, width = width, exdent = 4), collapse = "\n")
	res
}

Try the svMisc package in your browser

Any scripts or data that you put into this service are public.

svMisc documentation built on May 29, 2017, 12:18 p.m.