I have a dataframe with 1000 columns. I am trying to loop over 10 columns at a time and use the seqdef()
function from the TraMineR
package to do sequence alignment across the data in those columns. Hence, I want to apply this function to columns 1-10 in the first go-around, and columns 11-20 in the second go-around, all the way up to 1000.
This is the code I am using.
library(TraMineR)
by(df[, 1:10], seqdef(df))
However, this only loops over the first 10 and then stops. How do I loop it across chunks of 10 columns?