Re: [R] To Add a variable from Df1 to Df2 which have a same common variable

2014-09-19 Thread Arnaud Michel
Thank you to Marc Schwartz, Rui Barrada and Sarah Goslee Michel Le 19/09/2014 19:46, Marc Schwartz a écrit : On Sep 19, 2014, at 12:15 PM, Arnaud Michel wrote: Hello I have the two dataframes Df1 and Df2 which have the common variable AgeSexeCadNCad I would like to add the new variable Df2$Po

Re: [R] To Add a variable from Df1 to Df2 which have a same common variable

2014-09-19 Thread Rui Barradas
You might also want to try argument all.x: Df3 <- merge(Df2, Df1, by = "AgeSexeCadNCad", all.x = TRUE) This is because there are 2 rows in Df2 without a corresponding 'AgeSexeCadNCad' in Df1. Rui Barradas Em 19-09-2014 18:39, Rui Barradas escreveu: Hello, Try ?merge: Df3 <- merge(Df2, Df1

Re: [R] To Add a variable from Df1 to Df2 which have a same common variable

2014-09-19 Thread Marc Schwartz
On Sep 19, 2014, at 12:15 PM, Arnaud Michel wrote: > Hello > I have the two dataframes Df1 and Df2 which have the common variable > AgeSexeCadNCad > I would like to add the new variable Df2$Pourcent which correspond at the > value of Df1$AgeSexeCadNCad. > Thank you for your help. > Michel > >

Re: [R] To Add a variable from Df1 to Df2 which have a same common variable

2014-09-19 Thread Rui Barradas
Hello, Try ?merge: Df3 <- merge(Df2, Df1, by = "AgeSexeCadNCad") Hope this helps, Rui Barradas Em 19-09-2014 18:15, Arnaud Michel escreveu: Hello I have the two dataframes Df1 and Df2 which have the common variable AgeSexeCadNCad I would like to add the new variable Df2$Pourcent which corres

Re: [R] To Add a variable from Df1 to Df2 which have a same common variable

2014-09-19 Thread Sarah Goslee
Is merge() what you're looking for? On Fri, Sep 19, 2014 at 1:15 PM, Arnaud Michel wrote: > Hello > I have the two dataframes Df1 and Df2 which have the common variable > AgeSexeCadNCad > I would like to add the new variable Df2$Pourcent which correspond at the > value of Df1$AgeSexeCadNCad. > T

[R] To Add a variable from Df1 to Df2 which have a same common variable

2014-09-19 Thread Arnaud Michel
Hello I have the two dataframes Df1 and Df2 which have the common variable AgeSexeCadNCad I would like to add the new variable Df2$Pourcent which correspond at the value of Df1$AgeSexeCadNCad. Thank you for your help. Michel Df1 <- structure(list(AgeSexeCadNCad = structure(1:36, .Label = c("6