[R] reduce and intersect question (maybe)?

Andras Farkas motyoc@k@ @end|ng |rom y@hoo@com
Thu Feb 21 19:06:00 CET 2019

Works well! Thanks!

    On Thursday, February 21, 2019, 8:47:51 AM EST, Jeff Newmiller <jdnewmil using dcn.davis.ca.us> wrote:  
 Use ?merge instead of intersect.

On February 21, 2019 5:22:46 AM PST, Andras Farkas via R-help <r-help using r-project.org> wrote:
>Hello All,
>wonder if you have a suggestion for the following:
>we have
>= 1),format='%m/%d/%Y %H:%M'),z=rnorm(7,1,1))
>= 1),format='%m/%d/%Y %H:%M'),z=rnorm(8,1,1))
>= 1),seq(as.Date('2011-01-11'),as.Date('2011-01-15'),by =
>1)),format='%m/%d/%Y %H:%M'),z=rnorm(10,1,1))
>= 1)),format='%m/%d/%Y %H:%M'),z=rnorm(11,1,1))
>#this function will do the obvious and give the IDs that are in all of
>the data frames based on the ID column
>intersect_all <- function(a,b,...){
>  Reduce(intersect, list(a,b,...))
>#I would like to extend this (or use another function) where the
>function would give all the rows (ie based on both columns as a
>condition) that are in all of the data frames, so the result should be
>as below as these 2 rows are in all of the data frames (the fact that
>the rows that are common in all data frames ie 1 and 3 in my example
>are I only set up for the sake of convenience, in reality their row
>number in each of the data frames may be different) . The value of z is
>of no particular importance, but once the common rows are identified I
>would want to subset the data frames to get these results:
>much appreciate your input,
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

Sent from my phone. Please excuse my brevity.  
	[[alternative HTML version deleted]]

More information about the R-help mailing list