Description Usage Arguments Details Examples
Specialised vapply
functions for scalars of each of the six atomic classes
in R:
1 2 3 4 5 6 7 8 9 10 11 |
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.
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.