is_category {madshapR} | R Documentation |
Test if an object is a valid dataset
Description
Tests if the input object is a valid dataset. This function mainly helps validate input within other functions of the package but could be used to check if a dataset is valid.
Test if vector object is a categorical variable, typically a column in a data frame. This function mainly helps validate input within other functions of the package.
Usage
is_category(x, threshold = NULL)
Arguments
x |
object to be coerced. |
threshold |
Optional. The function returns TRUE if the number of unique values in the input vector is lower. |
Value
A logical.
Examples
{
library(dplyr)
iris %>% summarise(across(everything(), is_category))
is_category(iris[['Species']])
}
[Package madshapR version 1.1.0 Index]