
Last chance! 50% off unlimited learning
Sale ends in
A regular R object is an R object that is either atomic or a list - checked with is.regular
. A (nested) list composed of regular objects at each level is unlistable - checked with is.unlistable
.
is.regular(x)
is.unlistable(l)
a R object.
a list.
logical(1)
- TRUE
or FALSE
.
is.regular
is simply defined as is.atomic(x) || is.list(x)
. is.unlistable
is defined as all(unlist(rapply2d(l, is.regular), use.names = FALSE))
. It could of course also be defined as all(rapply(l, is.atomic))
, but the above is a lot more efficient if l
contains data.frame
's.
# NOT RUN {
is.regular(list(1,2))
is.regular(2)
is.regular(a ~ c)
l <- list(1, 2, list(3, 4, "b", FALSE))
is.regular(l)
is.unlistable(l)
l <- list(1, 2, list(3, 4, "b", FALSE, e ~ b))
is.regular(l)
is.unlistable(l)
# }
Run the code above in your browser using DataLab