Learn R Programming

dapr (version 0.0.3)

ilap: Iterator list apply

Description

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

Usage

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

Run this code
# NOT RUN {
## 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]))

# }

Run the code above in your browser using DataLab