Re: [R] Merge two data frames and find common values and non-matching values

2011-10-04 Thread francesca casalino
Sorry---I thought it worked but I think I am actually definitely doing something wrong... The problem might be that there are NA's and there are also duplicated values...My fault. I can't figure out what is going wrong... I'll be more thorough and modify the two df to mirror more what I have to ex

Re: [R] Merge two data frames and find common values and non-matching values

2011-10-04 Thread francesca casalino
Yes, your code did exactly what I needed. Thank you!! -f [[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-gu

Re: [R] Merge two data frames and find common values and non-matching values

2011-10-03 Thread Sarah Goslee
Hi, On Mon, Oct 3, 2011 at 1:54 PM, francy wrote: > Hi, > > I am trying to find a function to match two data frames of different lengths > for one field only. > So, for example, > df1 is: > > Name Position location > francesca A 75 > cristina B 36 > > And df2 is: > > location Country > 75 UK > 5

Re: [R] Merge two data frames and find common values and non-matching values

2011-10-03 Thread William Dunlap
Start out with merge(): > df <- merge(df1, df2, all.x=TRUE) # could add by="location" for emphasis > df location Name Position Country 1 36 cristinaB 2 75 francescaA UK You could make make your 'Match' column from is.na(df$Country) if you knew