Hi there!
Here is a solution using only base-R. I've also included a example dataset that is more like your original description:
# example data with only 930 rows
df <- data.frame(X = rep(c("A","B","C"), each = 310),
Y = rep(c("D","E","F"), each = 310),
Z = rep(c("G","H","I"), each = 310))
# number of splits to do
n_cols <- nrow(df)/310
# subsetting each split seperately, store in a list
df_l <-
lapply(1:n_cols,function(i){
startrow <- (i-1) * 310 + 1
endrow <- i*310
df[startrow:endrow, c(1,2,3)]
})
# bind list elements together
df_new <-
do.call(cbind, df_l)
# find which columns to remove per your requirements
ncols <- ncol(df_new)
toremove <- seq(4, ncols, by = 2)
# remove columns
df_new <-
df_new[-toremove]
Hope this helps!
Best