try this. Splits the dataframe based on the two IDs and then chooses
the first one in cases where condition not met.
> id1<-c(1,1,2,2,3,3,4,5,5,6,6,7,8,9,9,10)
> id2<-c(22,22,34,34,15,15,76,45,45,84,84,37,52,66,66,91)
> GENDER<-sample(c("G-UNK","G-M","G-F"),16, replace = TRUE)
> ETH <-sample(
G-F E-AF
#7 7 37 G-F E-AF
#8 8 52 G-F E-AF
#9 9 66 G-F E-AF
#10 10 91 G-F E-VT
A.K.
- Original Message -
From: arun
To: Robert Lynch
Cc: R help
Sent: Saturday, September 7, 2013 11:30 AM
Subject: Re: [R] finding both rows that are duplicated in a data frame
- Original Message -
From: Robert Lynch
To: R help
Cc:
Sent: Saturday, September 7, 2013 3:02 AM
Subject: [R] finding both rows that are duplicated in a data frame
I have a data frame that looks like
id1<-c(1,1,2,2,3,3,4,5,5,6,6,7,8,9,9,10)
id2<-c(22,22,34,34,15,15,76,45,45,84,84,
I have a data frame that looks like
id1<-c(1,1,2,2,3,3,4,5,5,6,6,7,8,9,9,10)
id2<-c(22,22,34,34,15,15,76,45,45,84,84,37,52,66,66,91)
GENDER<-sample(c("G-UNK","G-M","G-F"),16, replace = TRUE)
ETH <-sample(c("E-AF","E-UNK","E-VT"),16, replace = TRUE)
example<-cbind(id1,id2,GENDER,ETH)
where there a
4 matches
Mail list logo