OneBite.Dev - Coding blog in a bite size

find the unique elements in two arrays in R

Code snippet on how to find the unique elements in two arrays in R

  unique_elems <- unique(c(arr_1, arr_2))

This code finds the unique elements in two arrays. The function ‘c()’ combines the two arrays and the function ‘unique()’ returns the elements in the array that only appear once. The result is stored in the variable ‘unique_elems’.

r