get_all_factors {labelr}R Documentation

Put Data Frame Factor Level Information into a List

Description

get_all_factors returns a list of character vectors, where each character vector is a given factor variable's unique levels, and where the vector is given the same name as the factor variable itself. If the data.frame contains no factors, an empty (length 0) list is returned.

Usage

get_all_factors(data)

Arguments

data

the data.frame you are checking for factor variables.

Value

A list of 0, 1, or more character variables.

Examples

class(get_all_factors(iris))
length(get_all_factors(iris))
zz <- iris
zz$u <- zz$Species # zz has two factor variables
class(get_all_factors(zz))
length(get_all_factors(zz))
get_all_factors(mtcars)
length(get_all_factors(mtcars))

[Package labelr version 0.1.5 Index]