Re: [R] Problems using unique function and !duplicated

2011-02-28 Thread Ted Harding
On 28-Feb-11 15:51:17, JonC wrote: > Hi, I am trying to simultaneously remove duplicate variables from two > or more > variables in a small R data.frame. I am trying to reproduce the SAS > statements from a Proc Sort with Nodupkey for those familiar with SAS. > > Here's my example data : > > te

Re: [R] Problems using unique function and !duplicated

2011-02-28 Thread Claudia Beleites
Jon, you need to combine the conditions into one logical value, e.g. cond1 & cond2, e.g. !duplicated(test$date) & !duplicated(test$var2) However, I doubt that this is what you want: you remove too many rows (rows whose single values appeared already, even if the combination is unique). Have

Re: [R] Problems using unique function and !duplicated

2011-02-28 Thread Ivan Calandra
Hi Jon, I think you made a mistake in your desired output. If it is indeed a mistake, then this should do: test[!duplicated(test[,c("date","var2")]),] HTH, Ivan PS: think about dput() when you want to share objects, in this case dput(test) Le 2/28/2011 16:51, JonC a écrit : Hi, I am tryin

[R] Problems using unique function and !duplicated

2011-02-28 Thread JonC
Hi, I am trying to simultaneously remove duplicate variables from two or more variables in a small R data.frame. I am trying to reproduce the SAS statements from a Proc Sort with Nodupkey for those familiar with SAS. Here's my example data : test <- read.csv("test.csv", sep=",", as.is=TRUE) > t