Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

match.funfn

Generic extended version of R match.fun


Description

A generic match.fun.

Usage

match.funfn(FUN, descend = TRUE)

Arguments

FUN

Function, character name of function or formula describing function.

descend

logical; control whether to search past non-function objects.

Details

The default method is the same as match.fun and the formula method is the same as as.function.formula. This function can be used within the body of a function to convert a function specification whether its a function, character string or formula into an actual function.

Value

Returns a function.

See Also

Examples

# return first argument evaluated at second argument squared.
sq <- function(f, x) {
   f <- match.funfn(f)
   f(x^2)
}

# call sq using different forms for function
sq(function(x) exp(x)/x, pi)
f <- function(x) exp(x)/x
sq("f", pi)
sq(~ exp(x)/x, pi)
sq(x ~ exp(x)/x, pi)

gsubfn

Utilities for Strings and Function Arguments

v0.7
GPL (>= 2)
Authors
G. Grothendieck
Initial release
2018-03-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.