get_unique_col_vals: Extract the unique, non-duplicate values in a column

View source: R/get_unique_col_vals.R

get_unique_col_valsR Documentation

Extract the unique, non-duplicate values in a column

Description

Given a data frame and a column, the function will return the unique values of that column. Useful when making factors.

Usage

get_unique_col_vals(data, x)

Arguments

data

A data frame or tibble

x

Column in the data

Value

A character vector or NULL

Examples

get_unique_col_vals(data = iris,
                    x = Species)

iris2 <- subset(iris, Species != "setosa")
table(iris2$Species)
get_unique_col_vals(data = iris2,
                    x = Species)

get_unique_col_vals(data = mtcars, x = gear)

emilelatour/lamisc documentation built on April 9, 2024, 10:33 a.m.