Combining different number of rows files


#1

Hi,

Can anyone recommend hoe to combine files with different number of rows and columns? rbind and cbind don't work.

Thanks


#2

dplyr::bind_rows and dplyr::bind_cols, depending on how you want to do it. I like those functions much more than rbind and cbind. Give them a shot!


#3

Awesome. Thanks, dplyr should be installed as install.packages("dplyr") and the library imported as library(dplyr)?


#4

Once you install dplyr, you can use function in a qualified manner exactly as @cole demonstrated: dplyr::bind_rows and/or dplyr::bind_cols. In that case you don't need to add library(dplyr) to your script.
If you do add it, then you can use it without a qualifier (bind_rows/bind_cols), but I would say that first variant is better as it makes it abundantly clear where functions are coming from.


#5

Thank you for your response.