df_is {W4MRUtils}R Documentation

Test type of a data frame.

Description

df_is This function tests if the columns of a data frame are all of the same type.

Usage

df_is(df, type)

Arguments

df

The data frame.

type

The type you expect the columns to have. It must be one of the R base types: - 'character' ; - 'factor' ; - 'integer' ; - 'numeric' ; - 'logical'.

Value

TRUE or FALSE.

Examples

# Test if a data frame contains only integers
df <- data.frame(a = c(1, 4), b = c(6, 5))
# should return FALSE since in R all integers are converted to
# numeric by default.
W4MRUtils::df_is(df, "integer")
# should return TRUE.
W4MRUtils::df_is(df, "numeric")


[Package W4MRUtils version 1.0.0 Index]