Learn R Programming

hmi (version 0.9.16)

get_type: Get the type of variables.

Description

Function checks of which type a variable is. The types are listed below (together with a rough summary of the classification mechanism).

  • continuous (numeric values, or integers with more than 20 different values),

  • semicontinuous (numeric values with more than 10% of them share the same value),

  • rounded continuous (if more than 50% of the observations of a continuous variable are divisible by some rounding degrees)

  • count data (integers).

  • an intercept (the same value for all observations),

  • binary (two different values - like 0s and 1s or "m" and "f"),

  • categorical (the variable is a factor or has more than 3 different values)

  • ordered categorical (the categorical variable is ordered.)

Usage

get_type(variable, spike = NULL, rounding_degrees = c(1, 10, 100,
  1000))

Arguments

variable

A variable (vector) from your data set.

spike

A numeric value, denoting the presumed spike of semi-continuous variables.

rounding_degrees

A numeric vector with the presumed rounding degrees. If the rounding_degrees are set to be NULL, the proposed rounding degrees from the function suggest_rounding_degrees are used.

Value

A character denoting the type of variable.

Examples

Run this code
# NOT RUN {
get_type(iris$Sepal.Length); get_type(iris$Species)
# }

Run the code above in your browser using DataLab