vxapply: Specialised vapply methods for atomic classes

Description Usage Arguments Details Examples

Description

Specialised vapply functions for scalars of each of the six atomic classes in R:

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
vlapply(X, FUN, ..., USE.NAMES = TRUE)

viapply(X, FUN, ..., USE.NAMES = TRUE)

vnapply(X, FUN, ..., USE.NAMES = TRUE)

vcapply(X, FUN, ..., USE.NAMES = TRUE)

vzapply(X, FUN, ..., USE.NAMES = TRUE)

vrapply(X, FUN, ..., USE.NAMES = TRUE)

Arguments

X, ..., USE.NAMES

See vapply

FUN

Either a function to apply to each element of X, as in vapply or the field/method name of an OOP object (see examples)

Details

These are simply wrappers around vapply where FUN.VALUE is pre-filled with a scalar of the given class.

In addition these can be applied to pull-out fields or methods from R6 or other OOP objects by supplying the field/method name to FUN. See examples.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Specialised vapply
vlapply(logical(10), identity)
vzapply(complex(10), identity)

## For R6 objects
objs <- list(ooplah$new(), ooplah$new())

# Public field
vcapply(objs, "oop")

# Public method
vcapply(objs, "exclaim", "ARGH")
vcapply(objs, "hello")
vnapply(objs, "generate", 1)

# Active binding
vlapply(objs, "logically")

ooplah documentation built on Sept. 10, 2021, 5:08 p.m.