I have a dataset that is like this: list
df |
---|
200000 |
5666666 |
This dataset continues to 5551
Another dataset has also 5551 observations. I want to merge list dataset with another dataset. But no variable is the same. Just row names are the same.
I gave that
merge(list,df,by="rownames")
The error message is that it should have a valid column name
I tried also merge_all but not work
It is not working? Could someone please help
CodePudding user response:
It's good practice to be more precise with the naming of your dataframe variables. I wouldn't use list
but something like df_description
. Either way, merging by rownames can be achieved by using by = "row.names"
or by = 0
. You can read more on merge()
in the documentation (under "Details").