# Find Unique Values in List in R (Example)

In this tutorial youâ€™ll learn how to get all unique elements of a list in the R programming language.

The article consists of one example for the identification of unique values. To be more precise, the post consists of the following:

Letâ€™s dive into itâ€¦

## Creation of Exemplifying Data

Weâ€™ll use the data below as basement for this R programming tutorial:

```my_list <- list(l1 = letters[1:4],    # Create example list
l2 = letters[2:5],
l3 = letters[10:7],
l4 = letters[8:11])
my_list                               # Create example list
# \$l1
# [1] "a" "b" "c" "d"
#
# \$l2
# [1] "b" "c" "d" "e"
#
# \$l3
# [1] "j" "i" "h" "g"
#
# \$l4
# [1] "h" "i" "j" "k"
#```

The previous output of the RStudio console shows the structure of our example data â€“ Itâ€™s a list containing four list elements. Each of these list elements consists of several alphabetical letters.

## Example: Identify Unique Values in List Using unlist() & unique() Functions

This example illustrates how to find all unique items of our list using the unique and unlist functions in R.

Have a look at the following R code:

```unique(unlist(my_list))               # Return unique values
#  [1] "a" "b" "c" "d" "e" "j" "i" "h" "g" "k"```

As you can see based on the previous output of the RStudio console, we have created a character vector containing all unique values of our list.

## Video & Further Resources

If you need further information on the R syntax of this tutorial, you might want to have a look at the following video of my YouTube channel. In the video, Iâ€™m showing the R programming code of this article in a live session:

Furthermore, you might read some of the related tutorials of my website. You can find a selection of related tutorials below.