I am trying to build a for loop that will conduct a series of full joins in dplyr.
I would like to speed up this:
join1 <- full_join(Q1_output, Q2_output)
join2 <- full_join(join1, Q3_output)
join3 <- full_join(join2, Q4_output)
join4 <- full_join(join3, Q5_output)
join5 <- full_join(join4, Q6_output)
join6 <- full_join(join5, Q7_output)
join7 <- full_join(join6, Q8_output)
join8 <- full_join(join7, Q9_output)
The number of output files will not always equal 9 but they will always be in the format Qn_output where n changes for a given series of analysis.
Is there a way to construct a function that will do this? The output files will always be data frames & will always be joining on a common variable. I would also appreciate any feedback on whether a similar loop could be constructed to take a N column data frame and turn it into N vectors (e.x. repeating Q1 <- data$Q1, Q2 <- data$Q2).
Thank you!