Learn R Programming

crunch (version 1.30.4)

categoriesFromLevels: Convert a factor's levels into Crunch categories.

Description

Crunch categorical variables have slightly richer metadata than R's factor variables. This function generates a list of category data from a factor's levels which can then be further manipulated in R before being imported into Crunch.

Usage

categoriesFromLevels(level_vect)

Value

A list with each category levels id, name, numeric_value, and missingness.

Arguments

level_vect

A character vector containing the levels of a factor. Usually obtained by running base::levels()

Examples

Run this code

categoriesFromLevels(levels(iris$Species))

Run the code above in your browser using DataLab