[R] looking for setdiff equivalent on dataset
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.
Re: [R] looking for setdiff equivalent on dataset
perfect ! thx ( I found prob::setdiff too.. but not really what i want) 2010/7/29 Hadley Wickham > Here's one way, using a function from the plyr package: > > TheLittleOne<-data.frame(cbind(c(2,3),c(2,3))) > TheBigOne<-data.frame(cbind(c(1,1,2),c(1,1,2))) > > keys <- plyr:::join.keys(TheBigOne, TheLittleOne) > > !(keys$x %in% keys$y) > > TheBigOne[!(keys$x %in% keys$y), ] > > Hadley > > On Thu, Jul 29, 2010 at 1:38 PM, BaKaLeGuM 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. > > > > > > -- > Assistant Professor / Dobelman Family Junior Chair > Department of Statistics / Rice University > http://had.co.nz/ > [[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.
[R] full screen graph, and close x11
Hi everybody! I'm looking for a function or option to make a full screen plot.. can you help me? and I would like to know if it's possible to automaticaly close a x11 windows.. because i have more than 100 graph to generate and what i want is: 1 - make a full screen graph 2 - save this plot in emf format 3 - close the plot (goto 1) thanks for your advices [[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.
Re: [R] full screen graph, and close x11
thx , i will look that. I'm both on windows and linux 2009/3/12 Eik Vettorazzi > Hi, > see > ?dev.off > but I think (guessing you use a windows system), you would be better of in > using win.metafile() instead of x11() in initiating the graph, see > ?win.metafile > There is no need to show all 100+ graphs on your display if you actually > want them in files. > hth. > > BaKaLeGuM schrieb: > >> Hi everybody! >> >> I'm looking for a function or option to make a full screen plot.. can you >> help me? >> and I would like to know if it's possible to automaticaly close a x11 >> windows.. >> >> because i have more than 100 graph to generate and what i want is: >> >> 1 - make a full screen graph >> 2 - save this plot in emf format >> 3 - close the plot (goto 1) >> >> thanks for your advices >> >>[[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. >> >> > > -- > Eik Vettorazzi > Institut für Medizinische Biometrie und Epidemiologie > Universitätsklinikum Hamburg-Eppendorf > > Martinistr. 52 > 20246 Hamburg > > T ++49/40/42803-8243 > F ++49/40/42803-7790 > > [[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.