Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

is.data.frame.simple

Check if a data frame is a simple collection of columns (no lists or matrices within)


Description

Checks for the existence of dimensions within the data frame. Returns FALSE if any object within dframe has non-null dim value.

Usage

is.data.frame.simple(dframe)

Arguments

dframe

A data frame

Details

See: http://stackoverflow.com/questions/38902880/data-frame-in-which-elements-are-not-single-columns

Value

Boolean, TRUE or FALSE. An attribute "not_a_simple_column" is created, indicating which of the elements in the dframe have dimensions

Author(s)

Paul Johnson <pauljohn@ku.edu>

Examples

N <- 100
mydf <- data.frame(x5 = rnorm(N),
                   x4 = rpois(N, lambda = 3),
                   x3 = ordered(sample(c("lo", "med", "hi"),
                   size = N, replace=TRUE)))
is.data.frame.simple(mydf)
mydf$amatr <- matrix(0, ncol = 2, nrow = NROW(mydf))
is.data.frame.simple(mydf)
mydf$amatr <- NULL
is.data.frame.simple(mydf)
mydf$adf <- mydf
is.data.frame.simple(mydf)

kutils

Project Management Tools

v1.70
GPL-2
Authors
Paul Johnson [aut, cre], Benjamin Kite [aut], Charles Redmon [aut], Jared Harpole [ctb], Kenna Whitley [ctb], Po-Yi Chen [ctb], Shadi Pirhosseinloo [ctb]
Initial release
2020-04-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.