My data frame is
c1 c2 c3 c100 0.2 0.4 0.9 0 0.2 0.3 0 1 0.1 0.6 1 0.3
I want ot select c1 c2 and c3, the c1 c2 and c4, similarly c1 c2
assuming that x is your data.frame you can use this:
x
data.frame
for (i in 3:100){ tmp <- x[, c(1,2,i)] write.table(tmp, paste0("some/file/path/and/name_", i, ".csv")) }
By using the iterator i for the file name, you can create individual file names.
i