lap: lap: List apply functions

Description Usage Arguments Value See Also Examples

Description

Function(s) that apply expressions to input data objects and return lists.

lap: Iterate over input and return list(s)

lapr: Iterate over input rows and return list(s)

lapr: Iterate over input columbs and return list(s)

Usage

1
2
3
4
5
6
7
lap(.data, .f, ...)

lapr(.data, .f, ...)

lapc(.data, .f, ...)

lap2(.x, .y, .f, ...)

Arguments

.data

Input object–numeric, character, list, data frame, etc.–over which elements will be iterated. If matrix or data frame, each column will be treated as the elements which are to be iterated over.

.f

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

...

Other values passed to function call.

.x

First data vector input (for lap2)

.y

Second data vector input (for lap2)

Value

A list

See Also

dap vap

Other lap: ilap

Examples

1
2
3
4
5
6
7
8
## return string list
lap(letters, ~ paste0(.x, "."))

## return list of columns
lap(mtcars[1:5, ], as.character)

## map over two vectors
lap2(letters, LETTERS, ~ paste0(.x, .y, .x, .y))

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