componentsApply(X, FUN, ...)
FUN
.
FUN
,
for slots, list elements, and attributes of
X
.
There may be duplicates, e.g. for a matrix the
dim
attribute and
.Dim
slot are the same.
This function does not descend recursive objects,
such as functions and expressions.
Related functions include
recursiveApply
, which operates
recursively, and
lapply
, which handles only list elements.
# Determine whether an object or any of its components # (recursively) inherit from class "miVariable" tempf <- function(x) { inherits(x, "miVariable") || any(unlist(componentsApply(x, tempf))) } tempf(cholesterolImpExample)