Entering edit mode
19 months ago
rheab1230
▴
140
Hello everyone,
I have two dataframes: df1 and df2. I want to combine them using rbind
function. These two dataframe have some overlapping rownames. When combining it adds a value to the overlapping rownames.
For example:
df1 has one row as rs119151
df2 also has one row as rs119151
After combining its coming as
rs119151
rs1191511
I want it to show as:
rs119151
rs119151.1
and so on if we have more same rows for this value.
I am trying to use make.names command but its not working for me?
new <- make.names(rbind(df1,df2),unique=TRUE)
Is there any other way to do it?
Why/how isn't your command working? I'm guessing because
rbind()
already makes the names unique so themake.names()
function has nothing to rename. Tryas a sort of ugly workaround. If anyone knows how to modify the
rbind()
make.row.names behavior I'm all ears!But I also would think about this and make sure you really intend to be doing what you are doing. If the rownames are the same then why not just
cbind()
?