vap: vap: Vector apply functions

Description Usage Arguments Value See Also Examples

Description

Functions that apply expressions to input data objects and return atomic vectors e.g., numeric (double), character, logical.

vap_dbl: Iterate over input and return double(s)

vap_chr: Iterate over input and return character(s)

vap_lgl: Iterate over input and return logical(s)

vap_int: Iterate over input and return integer(s)

Usage

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

vap_chr(.data, .f, ...)

vap_lgl(.data, .f, ...)

vap_int(.data, .f, ...)

Arguments

.data

Input object<e2><80><93>numeric, character, list, data frame, etc.<e2><80><93>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.

Value

A double vector

A character vector

A logical vector

A integer vector

See Also

dap lap

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## character
vap_chr(letters, ~ paste0(.x, "."))

## double
vap_dbl(rnorm(4), round, 3)

## logical
vap_lgl(letters, ~ .x %in% c("a", "e", "i", "o", "u"))

## integer
vap_int(rnorm(5), ~ as.integer(.x))

dapr documentation built on May 7, 2019, 1:01 a.m.

Related to vap in dapr...