is_category: Test if an object is a valid dataset

View source: R/experimental.R

is_categoryR 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.

[Experimental] 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']])

}


madshapR documentation built on May 29, 2024, 7:43 a.m.