get.fn: Grab a function based on its name

View source: R/helper_functions.r

get.fnR Documentation

Grab a function based on its name

Description

Helper to grab a function that is passed in as an argument

Usage

get.fn(fn, env = parent.frame())

Arguments

fn

The function to search for

env

The environment to start searching in

Details

This is based on Hadley Wickham's response to an SO post: https://stackoverflow.com/questions/14183766/match-fun-provide-error-with-functions-defined-inside-functions with some minor modifications

Value

fn, if fn is already a function; otherwise, the first function found in env or one of its parents whose name is fn


dfeehan/surveybootstrap documentation built on Feb. 3, 2023, 6:52 a.m.