In collapse a regular R object is defined as 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, DF.as.list = TRUE)
an R object.
a list.
logical. TRUE
treats data frames like (sub-)lists; FALSE
like atomic elements.
logical(1)
- TRUE
or FALSE
.
is.regular
is simply defined as is.atomic(x) || is.list(x)
. is.unlistable
is defined as all(rapply(l, is.atomic))
. If l
contains data frames, setting DF.as.list = FALSE
yields checking using all(unlist(rapply2d(l, is.regular)))
, which can be a lot faster than applying is.atomic
to every data frame column.
# 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