unique for more than one variable

0 votes
In R, I've got the following data frame:

> 'data.frame' str(df): 545227 observations of 15 variables:
$ ykod: int 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93
$ yad : Factor with 42 levels "BAKUGAN","BARBIE",...: 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
$ donem: int 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 2011
sayi: int 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 201101
$ mkod: int 4 5 9 11 12 18 20 22 25 26...$ mkod: int 4 5 9 11 12 18 20 22 25 26...$ mkod: int
405 8075 9710 10145 9297 7973 $ mad: Factor with 10464 levels " Defne Market ",..: 405 8075 9710 10145 9297 7973
Jun 19 in Data Science by Avinash
• 1,260 points
7 views

1 answer to this question.

0 votes
df <- data.frame(yad = c("BARBIE", "BARBIE", "BAKUGAN", "BAKUGAN"),
                 per = c("AYLIK",  "AYLIK",  "2 AYLIK", "2 AYLIK"),
                 hmm = 1:4)

df
#       yad     per hmm
# 1  BARBIE   AYLIK   1
# 2  BARBIE   AYLIK   2
# 3 BAKUGAN 2 AYLIK   3
# 4 BAKUGAN 2 AYLIK   4

unique(df[c("yad", "per")])
#       yad     per
# 1  BARBIE   AYLIK
# 3 BAKUGAN 2 AYLIK
answered 4 days ago by Sohail
• 2,280 points

Related Questions In Data Science

0 votes
1 answer

What does |> (pipe greater than) mean in R?

The "pipe" operator in R is |>. ...READ MORE

answered Jun 14 in Data Science by Sohail
• 2,280 points
15 views
0 votes
0 answers

Unexpected behavior for setdiff() function in R

According to my understanding, the setdiff() function ...READ MORE

6 days ago in Data Science by avinash
• 860 points
10 views
0 votes
0 answers

Calculate correlation with cor(), only for numerical columns

I have a dataframe and would like ...READ MORE

4 days ago in Data Science by Sohail
• 2,280 points
3 views
0 votes
1 answer

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

answered Dec 18, 2017 in Data Analytics by Sudhir
• 1,610 points
422 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
467 views
0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
4,280 views
0 votes
1 answer

Left Join and Right Join using "dplyr"

The below is the code to perform ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
491 views
0 votes
1 answer

How to make loop for one-at-a time logistic regression in R?

You're probably looking for something similar to ...READ MORE

answered Jun 20 in Data Science by Sohail
• 2,280 points
16 views
0 votes
1 answer

Reasons for using the set.seed function

The requirement is a desire for repeatable ...READ MORE

answered Jun 20 in Data Science by Sohail
• 2,280 points
14 views
0 votes
1 answer

Can I use more than one Public IP for a VM?

It appears you can now have multiple ...READ MORE

answered May 30, 2018 in Azure by null_void
• 3,220 points
174 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP