Skip to contents

Data Manipulation Utilities

Pull Unique Values from a dataframe

Usage

pull_unique(df, var)

Arguments

df

a provided data.frame()

var

character/numeric - quoted named of a variable from df or its numerical index.

Value

  • pull_unique returns a character vector of unique, sorted values from specified column

Examples

df <- data.frame(let = rep(letters, 2), num = rep(c(1:26), 2))
pull_unique(df, 1)
#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
#> [20] "t" "u" "v" "w" "x" "y" "z"
pull_unique(df, "num")
#>  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#> [26] 26