Hi!

I want to write portions of my data (3573 columns at a time) to twenty
folders I have available titled "A_1" to "A_20" such that the first 3573
columns will go to folder A_1, next 3573 to folder A_2 and so on.

This code below ensures that the data is written into all 20 folders, but
only the last iteration of the loop (last 3573 columns) is being written
into ALL of the folders (A_1 to A_20) rather than the sequential order that
I would like.

How can I fix this?

Thank you!

*************************

Code:

A_var_df <- data.frame(index=1:length(seq(1.0, -0.9, by= -0.1)),
from=seq(1.0, -0.9, by= -0.1), to=seq(0.9, -1.0, by= -0.1))

for(i in 1:length(A_var_df[,1]))
{
library(plyr)
max.col <- ncol(Dchr1)
l_ply(seq(1, max.col, by=3573), function(k)
write.table(as.data.frame(Dchr1[,k:min(k+3572, max.col)]), paste("./A_",
A_var_df[i,1], "/k.csv", sep=""), sep=",", row.names=F, quote=F) )
}

**************************

-- 
Thanks,
CC

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to