Learn R Programming

PhotoGEA (version 1.4.0)

is.exdf: Is an object an exdf?

Description

Checks whether an object is an exdf object.

Usage

is.exdf(x, consistency_check = FALSE)

Value

A logical (TRUE / FALSE) value indicating whether the object is an exdf

object.

Arguments

x

An R object.

consistency_check

A logical value indicating whether to perform additional consistency checks.

Details

The default version of is.exdf simply checks to see if 'exdf' is in class(x).

If consistency_check is TRUE, then additional checks will be performed to make sure the object has three elements named main_data, units, and categories; that these elements are data frames with the same column names; and that units and categories each have one row. These requirements are all part of the definition of an exdf object, but these checks require additional time so they are not always desired.

See Also

exdf

Examples

Run this code
# Test a simple exdf object
simple_exdf <- exdf(data.frame(A = 1), data.frame(A = 'u'), data.frame(A = 'c'))
is.exdf(simple_exdf)
is.exdf(simple_exdf, TRUE)

# Test an object that is clearly not an exdf
not_an_exdf <- 2
is.exdf(not_an_exdf)
is.exdf(not_an_exdf, TRUE)

# Test an object that claims to be an exdf but does not meet all of the
# requirements
fake_exdf <- not_an_exdf
class(fake_exdf) <- c('exdf', class(fake_exdf))
is.exdf(fake_exdf)
is.exdf(fake_exdf, TRUE)

Run the code above in your browser using DataLab