Hi, R-listers,

Failed, when I tried to merge df1 and df2 by "codetot" in df1 and "codetoto"
in df2. I want to know the reason and how to merge them together. Data
frames and codes I have used were listed as followed. Thanks a lot in
advance.

df1:
popcode     codetot   p3need
BCPy01-01 BCPy01-01-1 100.0000
BCPy01-01 BCPy01-01-2 100.0000
BCPy01-01 BCPy01-01-3 100.0000
BCPy01-02 BCPy01-02-1  92.5926
BCPy01-02 BCPy01-02-1 100.0000
BCPy01-02 BCPy01-02-2  92.5926
BCPy01-02 BCPy01-02-2 100.0000
BCPy01-02 BCPy01-02-3  92.5926
BCPy01-02 BCPy01-02-3 100.0000
BCPy01-03 BCPy01-03-1 100.0000

df2:
popcode    codetoto   areasec
BCPy01-01 BCPy01-01-1 0.5089434
BCPy01-01 BCPy01-01-2 0.6246381
BCPy01-01 BCPy01-01-3 0.4370059
BCPy01-02 BCPy01-02-1 0.9253052
BCPy01-02 BCPy01-02-1 0.6011810
BCPy01-02 BCPy01-02-2 0.6710850
BCPy01-02 BCPy01-02-2 0.7145839
BCPy01-02 BCPy01-02-3 0.9515256
BCPy01-02 BCPy01-02-3 0.6555006
BCPy01-03 BCPy01-03-1 0.8683875

code:
new1<-merge(df1,df2,by=c("popcode","popcode"),all=T) # It is processed well.
But, it is not what I want.
new2<-merge(df1,df2,by=c("codetot","codetoto"),all=T) # this one failed. I
exactly want to do that.

Mao J-F
IBCAS, AC

	[[alternative HTML version deleted]]


