Apply Unique Function to Multiple Columns of Data Frame in R | Using unique & duplicated Functions

preview_player
Показать описание
R code of this video:

x2 = c("a", "a", "b", "b", "b", "c"),
x3 = LETTERS[1:6])

data_unique <- unique(data[ , c("x1", "x2")]) # Apply unique

data_duplicated <- data[!duplicated(data[ , c("x1", "x2")]), ] # Apply duplicated

Follow me on Social Media:
Рекомендации по теме
Комментарии
Автор

Your videos on R are simply the best on YouTube. Thank you for uploading such a great content!

Greetings from Brazil!

pedrocolangelo
Автор

Very useful. I’ve always used unique on individual columns.

dangunwangum
Автор

I have 2 categorical variable columns, is there a way to find unique values of column a and those values by column b, so that i can see what unqiue values of column a correspond with the unique values of column b. Alot of videos seem to be counting unique variables, whilst i am trying view two categorical columns.

oil_lord
Автор

Nice! I was wondering if there is an easy way to create new columns (maybe with mutate()) and that each of the results of those columns depend on each other. Like if column A is creating by multiplying a constant k*B, being B the second column that is calculating by (k-A = k*B)

luisroca