Re: [R] merge function

2015-06-01 Thread John Kane
Subject: Re: [R] merge function > > I understood that by would take the intersection of names(x) and > names(y), names(x) being the column names of x and names(y), column names > of y. > if x has 5 col and the col names of x are col1, col2... col5 and y has 3 > col and their name

Re: [R] merge function

2015-06-01 Thread Bert Gunter
You do not appear to understand what merge() does. Go through the worked examples in ?merge so that you do. FWIW, I would agree that the Help file is cryptic and difficult to understand. Perhaps going through a tutorial on database "join" operations might help. Cheers, Bert Bert Gunter "Data is

Re: [R] merge function

2015-06-01 Thread carol white via R-help
I understood that by would take the intersection of names(x) and names(y), names(x) being the column names of x and names(y), column names of y. if x has 5 col and the col names of x are col1, col2... col5 and y has 3 col and their names are col1, col2, col3, I thought that the merged data set wi

Re: [R] merge function

2015-06-01 Thread Michael Dewey
On 01/06/2015 14:46, carol white via R-help wrote: Hi,By default the merge function should take the intersection of column names (if this is understood from by = intersect(names(x), names(y)), Dear Carol The by parameter specifies which columns are used to merge by. Did you understand it t

Re: [R] merge function

2015-06-01 Thread John Kane
> Sent: Mon, 1 Jun 2015 06:29:41 -0800 > To: wht_...@yahoo.com, r-help@r-project.org > Subject: RE: [R] merge function > > As Burt says it is not exactly clear what you want but is something like > this what you are looking for? > > dat1 <- data.frame(aa = c

Re: [R] merge function

2015-06-01 Thread John Kane
> From: r-help@r-project.org > Sent: Mon, 1 Jun 2015 13:46:15 + (UTC) > To: r-help@r-project.org > Subject: [R] merge function > > Hi,By default the merge function should take the intersection of column > names (if this is understood from by = intersect(names

Re: [R] merge function

2015-06-01 Thread Bert Gunter
1. Please read and follow the posting guide. 2. Reproducible example? (... at least I don't understand what you mean) 3. Plain text, not HTML. Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Mon,

[R] merge function

2015-06-01 Thread carol white via R-help
Hi,By default the merge function should take the intersection of column names (if this is understood from by = intersect(names(x), names(y)), but it takes all columns. How to specify the intersection of column names?  Thanks Carol [[alternative HTML version deleted]] ___

Re: [R] merge function to combine two tables

2013-03-14 Thread jim holtman
Take a look at your data. When I loaded what you attached, there were only 9 species that were in common across the two files: > dim(s16) [1] 226 83 > dim(s15) [1] 96 41 > sum(s15$species %in% s16$species) [1] 10 > sum(s16$species %in% s15$species) [1] 10 > length(intersect(s16$species, s15$spec

Re: [R] merge function to combine two tables

2013-03-14 Thread John Kane
Below , in line John Kane Kingston ON Canada > -Original Message- > From: michael.eisenr...@gmx.ch > Sent: Thu, 14 Mar 2013 11:51:49 +0100 > To: r-help@r-project.org > Subject: [R] merge function to combine two tables > > Dear R-help members > > I would

Re: [R] merge function while obviating duplicate columns XXXX

2013-03-11 Thread William Dunlap
id Name Age 1 2 Ken 45 2 3 Leo 49 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Dan Abner > Sent: Monday, March 11, 2013 2:02 PM > To:

Re: [R] merge function while obviating duplicate columns XXXX

2013-03-11 Thread Jeff Newmiller
intersect(names(data1),names(data2)) --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO

Re: [R] merge function while obviating duplicate columns XXXX

2013-03-11 Thread Dan Abner
Ok, let's say I only want the common columns from data1. Is there a succinct way of doing this for potentially hundreds of "in common" columns? On Mon, Mar 11, 2013 at 3:25 PM, Ista Zahn wrote: > On Mon, Mar 11, 2013 at 3:17 PM, Dan Abner wrote: >> Hi everyone, >> >> I have the following call

Re: [R] merge function while obviating duplicate columns XXXX

2013-03-11 Thread Ista Zahn
On Mon, Mar 11, 2013 at 3:17 PM, Dan Abner wrote: > Hi everyone, > > I have the following call to the merge() function. How does one > prevent duplicate columns in the resulting data frame that the 2 > parent data frames have in common but are not true key or "by" > variables? > > > data3<-merge(d

[R] merge function while obviating duplicate columns XXXX

2013-03-11 Thread Dan Abner
Hi everyone, I have the following call to the merge() function. How does one prevent duplicate columns in the resulting data frame that the 2 parent data frames have in common but are not true key or "by" variables? data3<-merge(data1,data2,by="id") data3 id total.x total.y balance 1 78 78 90

Re: [R] Merge function - Return NON matches

2012-04-27 Thread RHelpPlease
Hi again, Petr, your solution worked! Thanks everyone for your input. I'll look more into "setdiff." Cheers! -- View this message in context: http://r.789695.n4.nabble.com/Merge-function-Return-NON-matches-tp4590755p4593101.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Merge function - Return NON matches

2012-04-27 Thread Petr PIKAL
Hi If you used shorter names for your objects you will get probably more readable advice Is this what you wanted? truncated_dataframe[truncated_dataframe$CLAIM_NO %in% setdiff(truncated_dataframe$CLAIM_NO, truncated_list$CLAIM_NO),] Regards Petr > Hi there, > I've tried the noted solutions

Re: [R] Merge function - Return NON matches

2012-04-27 Thread RHelpPlease
Hi there, I've tried the noted solutions: "If you do `no <- unlist(hrc_78_clm_no`, do you get a character vector of claim numbers you want to exclude? If so, then `subset(whatever, !CLAIM_NO %in% no)` should work." I converted the CLAIM_NO list to a character, with > hrc78_clmno_char <- format

Re: [R] Merge function - Return NON matches

2012-04-26 Thread chuck.01
# dput() example # lets say you have data called y, like this: > y sp1 sp2 sp3 sp4 d 0 0 0 0 e 0 0 0 0 f 0 0 0 0 # ok, so do this: > dput(y) structure(list(sp1 = c(0, 0, 0), sp2 = c(0, 0, 0), sp3 = c(0, 0, 0), sp4 = c(0, 0, 0)), .Names = c("sp1", "sp2", "sp3", "sp4" )

Re: [R] Merge function - Return NON matches

2012-04-26 Thread MacQueen, Don
Assuming everything else is good, the "all" or "all.x" or "all.y" arguments to merge() should do what I think you're asking for. You did read the help page for merge, right? -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 O

Re: [R] Merge function - Return NON matches

2012-04-26 Thread RHelpPlease
Hi there, Thanks for your responses. I haven't used/heard of dput() before. I'm looking it up & understanding how it works. Thanks! -- View this message in context: http://r.789695.n4.nabble.com/Merge-function-Return-NON-matches-tp4590755p4591003.html Sent from the R help mailing list archive

Re: [R] Merge function - Return NON matches

2012-04-26 Thread Steve Lianoglou
Hi, As Sarah reiterated -- it'd *really* be helpful if you give us data we can actually work with. That having been said: On Thu, Apr 26, 2012 at 4:12 PM, RHelpPlease wrote: > Hi again, > I tried the sample code like this: > >> merged_clmno <- subset(bestPartAreadmin, !CLAIM_NO %in% hrc78_clm_n

Re: [R] Merge function - Return NON matches

2012-04-26 Thread Sarah Goslee
You'd get better help if you actually did as Steve requested and provided sample data (a reproducible example!) using dput(). But since you didn't: > fakedata <- data.frame(a = 1:5, b=11:15, c=c(1,1,1,2,2)) > fakedata a b c 1 1 11 1 2 2 12 1 3 3 13 1 4 4 14 2 5 5 15 2 > notb <- c(12, 14, 15) >

Re: [R] Merge function - Return NON matches

2012-04-26 Thread RHelpPlease
Hi again, I tried the sample code like this: > merged_clmno <- subset(bestPartAreadmin, !CLAIM_NO %in% hrc78_clm_no) > dim(merged_clmno) [1] 1306893 Note that: > dim(bestPartAreadmin) [1] 1306893 So, no change between the original data.frame (bestPartAreadmin) & the (should be) less-row

Re: [R] Merge function - Return NON matches

2012-04-26 Thread RHelpPlease
Hi Steve, Thanks for replying. Here's a small piece of the data.frame: > bestPartAreadmin[1:5,1:6] DESY_SORT_KEY PRVDR_NUM CLM_THRU_DT CLAIM_NO NCH_NEAR_LINE_REC_IDEN_CD NCH_CLM_TYPE_CD 1 10193 290003 20090323 20

Re: [R] Merge function - Return NON matches

2012-04-26 Thread Steve Lianoglou
Hi, To increase the chances of you getting help on this one, please give example data (a small data.frame, a small list) that you are trying to do this on, and also show the desired output. Whip these variables up in your R workspace and paste the output of `dput` for each into your follow up emai

[R] Merge function - Return NON matches

2012-04-26 Thread RHelpPlease
Hi there, I wish to merge a common variable between a list and a data.frame & return rows via the data.frame where there is NO match. Here are some details: The list, where the variable/col.name = CLAIM_NO CLAIM_NO 20 83 1440 4439 7002 ... > dim(hrc78_clm_no) [1] 66781 The data.frame, where

Re: [R] merge function

2011-07-01 Thread peter dalgaard
On Jul 1, 2011, at 06:48 , Jeff Newmiller wrote: > You haven't provided a reproducible example. > > I do notice you are using T and F which are variables that can be redefined > (which is why TRUE and FALSE are preferred. Also, if x and y really are "vectors" (I bet they're not, though), you'l

Re: [R] merge function

2011-06-30 Thread Jeff Newmiller
You haven't provided a reproducible example. I do notice you are using T and F which are variables that can be redefined (which is why TRUE and FALSE are preferred. --- Jeff Newmiller The . . Go Live... DCN: Basics: #

Re: [R] merge function

2011-06-30 Thread Downey, Patrick
I was mistaken. There were duplicates in my y vector. Please ignore my previous message. Sorry. -Original Message- From: Downey, Patrick Sent: Thu 6/30/2011 11:08 PM To: r-help@r-project.org Subject: merge function Hello, I'm clearly confused about the merge function. In the following

[R] merge function

2011-06-30 Thread Downey, Patrick
Hello, I'm clearly confused about the merge function. In the following r <- merge(x,y,all.x=T,all.y=F) my y vector has only unique values (no duplicates). So I don't understand how this can ever generate an r which is of greater length than x. I thought the default behavior was only matching r

[R] 'merge' function creating duplicate columns names in the output

2011-03-03 Thread jim holtman
The "merge" command is creating duplicate column names in a dataframe that is the result of the merge. The following is the 'merge' command: x <- merge(invType , allocSlots , by.x = 'index' , by.y = 'indx' , all.x = TRUE ) The 'invType' dataframe was the result of a previous

Re: [R] merge function in R?

2010-08-16 Thread fishkbob
Thanks Chuck, I was trying to implement something more complicated than what I had to and after finding the reduce() function in bioconductor, everything went smoothly. Thanks again -- View this message in context: http://r.789695.n4.nabble.com/merge-function-in-R-tp2324684p2327133.html Sent

Re: [R] merge function in R?

2010-08-13 Thread Charles C. Berry
On Fri, 13 Aug 2010, fishkbob wrote: So I have a bunch of c(start,end) points and want to consolidate them into as few c(start,end) as possible. For example: sample startend A 5 10 B 7 18 C 14 D 16 20 I'd want

[R] merge function in R?

2010-08-13 Thread fishkbob
So I have a bunch of c(start,end) points and want to consolidate them into as few c(start,end) as possible. For example: sample startend A 5 10 B 7 18 C 14 D 16 20 I'd want the function to return the two distinct

Re: [R] merge function in R?

2010-08-13 Thread David Winsemius
Neither you nor your responder have continued the eamil chain very well so let me put things back together: on Aug 13, 2010; 03:54pm fishkbob wrote subj = merge function in R? So I have a bunch of c(start,end) points and want to consolidate them into as few c(start,end) as possible. For ex

Re: [R] merge function in R?

2010-08-13 Thread fishkbob
I too think I worded it incorrectly... so the second two columns of the matrix are the start and end of an interval however, because some of the intervals overlap, I want to limit the number of intervals I have to deal with. So therefore, (5 10)should merge with(7 18) making

Re: [R] merge function in R?

2010-08-13 Thread JesperHybel
I think it would be helpful if you could clarify youre question - do you want distinct sets - maybe use unique() but why (5,20) when its (5,10) in the row in youre example? What criteria do you want the function to select the "sets" by and what kind of output do you need? Maybe it's just me w