vxapply | R Documentation |
Specialised vapply
functions for scalars of each of the six atomic classes
in R:
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)
X, ..., USE.NAMES |
See vapply |
FUN |
Either a function to apply to each element of |
logical (vlapply
)
integer (viapply
)
numeric/real (vnapply
)
character/string (vcapply
)
complex (vzapply
)
raw (vrapply
)
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.
## 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.