Entering edit mode
3 months ago
rheab1230 ▴ 140
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.
df1 has one row as rs119151
df2 also has one row as rs119151
After combining its coming as
I want it to show as:
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 the
make.names()function has nothing to rename. Try
as 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