How can I create multiple columns in just a line of code? For instance, in the picture below, I am trying make the below six lines of code into a single line of code?
A1AFirstBatch4$OOATB1 <- with(A1AFirstBatch4, coalesce(Q1a, Q1b))
A1AFirstBatch4$OOATB2 <- with(A1AFirstBatch4, coalesce(Q2a, Q2b))
A1AFirstBatch4$OOATB3 <- with(A1AFirstBatch4, coalesce(Q3a, Q3b))
A1AFirstBatch4$OOATB4 <- with(A1AFirstBatch4, coalesce(Q4a, Q4b))
A1AFirstBatch4$OOATB5 <- with(A1AFirstBatch4, coalesce(Q5a, Q5b))
A1AFirstBatch4$OOATB6 <- with(A1AFirstBatch4, coalesce(Q6a, Q6b))
Created on 2021-04-07 by the reprex package (v2.0.0)