I want to create a function where the merging of two data frames occurs in pairs (i.e. df1 column 1 is next to df2 column 1, and then df1 column 2 is next to df2 column 2 (etc.)). Below is a script to make a two random data frames for reproducibility.
df1 <- data.frame(replicate(10,rnorm(20)))
df2 <- data.frame(replicate(10,rnorm(20)))
Essentially the goal outcome would be to have df1$X1 be next to df2$X1 , and then df1$X2 be next to df2$X2 and so on, stored in a new data frame (e.g. df3). I know it is possible to write it out in a data.frame() command but that would take too long. Is there a function which achieves this?
I know this question will likely have already been answered but I am unsure how to word the question and have as such not been able to find any way of doing this. Any help would be much appreciated. Thank you so much!