Try this also: TheBigOne[rowSums(!mapply(is.element, TheBigOne, TheLittleOne)) > 0,]
On Thu, Jul 29, 2010 at 3:38 PM, BaKaLeGuM <bakale...@gmail.com> wrote: > Hi everybody ! > > little question. > > I have 2 dataset > > TheLittleOne<-data.frame(cbind(c(2,3),c(2,3))) > TheBigOne<-data.frame(cbind(c(1,1,2),c(1,1,2))) > > And I would like to obtain the TheBigOne - TheLittleOne (the row in > TheBigOne not in TheLittleOne > > The result should be: > cbind(c(1,1),c(1,1)) > > > Have you any idea? > > > > > PS : this function work.. but too slow and too much complex!.. > > diff2data<-function(data1,data2){ > afaire<-setdiff(paste(data1[,1],data1[,2]),paste(data2[,1],data2[,2])) > afaire<-data.frame(t(data.frame(strsplit(afaire," ")))) > if (sum(dim(afaire)) > > !=0){afaire[,1]<-as.numeric(as.character(afaire[,1]));afaire[,2]<-as.numeric(as.character(afaire[,2]))} > return(afaire)} > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.