Learn R Programming

cheem (version 0.4.2)

is_discrete: Check if a vector is discrete

Description

Whether or not a vector is a discrete variable, returns a logical. Typically used on the Y variable of a model.

Usage

is_discrete(x, na.rm = TRUE)

Value

Logical, whether or not x is a discrete variable.

Arguments

x

A vector to check the discreteness of.

na.rm

Whether or not to remove NA values before testing discreteness. Defaults to TRUE.

See Also

Other cheem utility: as_logical_index(), color_scale_of(), contains_nonnumeric(), is_diverging(), linear_tform(), logistic_tform(), problem_type(), sug_basis(), sug_manip_var()

Examples

Run this code
library(cheem)

is_discrete(mtcars$mpg) ## Numeric column, with more than 25 unique values.
is_discrete(mtcars$cyl) ## Numeric column, labeled as discrete, because less than 25 unique values
is_discrete(letters)    ## Characters and factors labeled discrete.

Run the code above in your browser using DataLab