data_first: Adapt Functions to Take Data Argument First

View source: R/S03_Utilities.R

data_firstR Documentation

Adapt Functions to Take Data Argument First

Description

A function that ensures the first argument is always for 'data' - allows greater compatibility with the pipe operator.

Usage

data_first(data_obj, fun_to_apply, ...)

Arguments

fun_to_apply

An R function that has a data argument (e.g., stats::lm).

...

Additional arguments for the given function.

data_ob

An R object to pass to a given function's data argument.

Value

The associated output for the fun_to_apply function.

Examples

data( 'mtcars' )
lm_fit <- data_first( mtcars, lm, formula = mpg ~ cyl )
print( lm_fit )


rettopnivek/arfpam documentation built on Oct. 20, 2024, 7:24 p.m.