getFun: Extract a function by name with or without namespace prefix

View source: R/getFun.R

getFunR Documentation

Extract a function by name with or without namespace prefix

Description

Extract a function by name with or without namespace prefix

Usage

getFun(fun)

Arguments

fun

A character vector of length one, denoting the function to extract. May be prefixed with a namespace (or not).

Details

Most useful to create one-off functions where one wishes to call a specific function without loading the library, and also to access non-exported functions. See examples.

Value

A function matching fun, or NULL (with a message) if an error.

Note

See (and heed) documentation within getFromNamespace, which this function uses.

Examples

getFun("getFun")
getFun("getFun()") # paren pairs are stripped if included
getFun("stats::acf()")
getFun("stats:::[[.dendrogram")

slin30/wzMisc documentation built on Jan. 27, 2023, 1 a.m.