Q:

Split a dataset into a list of dataframes with equal number of columns

I have a data set with 36 columns and single observation. I want to split it into a list with each dataframe having 3 columns and then rbind them into a single data frame.
I have been using the following code:
m=12
nc<-ncol(df)
df1<-lapply(split(as.list(df), cut(1:nc, m, labels = FALSE)), as.data.frame)
df1<-do.call("rbind",df1)

This code is working. But the problem comes when I try to run this code in shiny app.
Can someone suggest a replacement for above code

A:

We can split the one row dataframe by generating a specific sequence
do.call("rbind", split(c(t(df)), rep(seq(1, ncol(df)/3), each = 3)))

where
rep(seq(1, ncol(df)/3), each = 3) 

would generate
[1]  1  1  1  2  2  2  3  3  3  4  4  4  5  5  5  6  6  6  7  7  7  8  8  8  
     9  9  9 10 10 10 11 11 11 12 12 12

