[R] same column name in a data frame

Jinsong Zhao jszhao at yeah.net
Tue Mar 14 02:56:14 CET 2017

Hi there,

I happened to find the following code can generate a data frame with 
same column name.

 > x <- data.frame(a=c(1,2,3))
 > y <- data.frame(a=c(2,3,4))
 > z <- cbind(x,y)

However, in this case, one can not use the $ to extract the second 
column, right?

Is it possible to prevent the cbind() produce a data frame with same 
column name?


More information about the R-help mailing list