vxapply {ooplah}R Documentation

Specialised vapply methods for atomic classes

Description

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

Usage

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

## 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")

[Package ooplah version 0.2.0 Index]