I would suggest use the same column names for the common columns. Say, use
"codetot" for both df1 and df2. Then you don't even have to specify by.x or
by.y, merge will do it automatically.
merge(df1,df2, all=TRUE).
Otherwise you have to
merge(df1,df2,by.x=c('popcode','codetot'),by.y=c('popcode','c
try this:
> merge(df1, df2, by.x='codetot',by.y='codetoto', all=TRUE)
codetot popcode.x p3need popcode.y areasec
1 BCPy01-01-1 BCPy01-01 100. BCPy01-01 0.5089434
2 BCPy01-01-2 BCPy01-01 100. BCPy01-01 0.6246381
3 BCPy01-01-3 BCPy01-01 100. BCPy01-01 0.4370059
4 BCPy01-02
2 matches
Mail list logo