Skip to content
Prev 70627 / 398528 Next

how to "singlify" entries

Hallo
On 30 May 2005 at 9:15, zhihua li wrote:

            
Well, I do not understand you simple question fully. You have 
something like that

dat<-data.frame(X=1:100, Y=sample(1:10,10))
dat$X<-factor(dat$X)
dat$Y<-factor(dat$Y)
dat$Y[5]<-10
Do you want to choose only some rows from your data frame to 
get unique Y and any corresponding X?

dat[!duplicated(dat$Y),]

Or do you want something different?

HTH
Petr
Petr Pikal
petr.pikal at precheza.cz