Say I wanted to extract every 4th element from mtcars, starting from column 2. I could do:
cars_subdf <- mtcars[seq(2, ncol(mtcars), 4)]
How could I do the reverse of this? e.g. insert cars_df col 1 as mtcars col 2, then column 2 of cars_df four columns along and so on? I know there's interleave and similar, but they only directly 'zippered' e.g. :
1a 1b 2a 2b
Thanks.