ilap: Iterator list apply

Description Usage Arguments Value See Also Examples

Description

ilap: Iterate over sequence length of input and return list(s)

Usage

1
ilap(.data, .f, ...)

Arguments

.data

Object representing the sequence length, used as ".i" in the .f expression. If matrix or data frame, sequence length will be determined by the number of columns. If integer, then it will be passed directly onto function call, otherwise the object will be converted into a sequence from 1 to the length of the object.

.f

Function to apply to each element (as an integer position) of input object. This can be written as a single function name e.g., mean, a formula-like function call where '.i' is assumed to be the integer position of input data object e.g., ~ mean(mtcars[[.i]]), or an in-line function definition e.g., function(x) mean(mtcars[[x]]).

...

Other values passed to function call.

Value

A list

See Also

Other lap: lap

Examples

1
2
3
4
5
## return string list
ilap(1:10, ~ paste0(letters[.i], rev(LETTERS)[.i]))

## return list of columns
ilap(mtcars, ~ c(row.names(mtcars)[.i], mtcars$wt[.i]))

mkearney/ifl documentation built on June 29, 2019, 7:33 a.m.