View source: R/dataframe_helpers.R
df_is | R Documentation |
df_is This function tests if the columns of a data frame are all of the same type.
df_is(df, type)
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'. |
TRUE
or FALSE
.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.