Reputation: 319
I have two data sets as CSV files with identical columns.
I want to merge them so that they are listed one below the other.
I tried this code but this only puts them together left to right:
merge(1, 2, by="Col A")
I am looking to list them one above the other in the merged data set, not next to each other.
Upvotes: 0
Views: 1496
Reputation: 6954
You can use bind_rows()
from dplyr. For a discussion why bind_rows
can sometimes be preferrable over rbind()
see the discussion here
one <- mtcars[1:4, ]
two <- mtcars[11:14, ]
# You can supply data frames as arguments:
bind_rows(one, two)
Upvotes: 2