r - Saving lot of data sets automatically -


i creating 22 data sets, , each data set has matrix 3 columns , 3 rows. trying save 22 data sets automatically in working directory, codes didn't work.

hers codes:

a<-array(0,dim=c(3,3,22)) ( iter in 1:22) { x<-rnorm(9,0,1) y<-matrix(x,ncol=3,byrow=t) a[,,iter]<-y filename1 <- paste (" a",1:22 ,".csv ", sep ="") write.table( a[,,iter]  , file = filename1 , row.names =false ,col.names = false ) } 

it gave me message:

error in file(file, ifelse(append, "a", "w")) : invalid 'description' argument

in addition: warning message: in if (file == "") file <- stdout() else if (is.character(file)) { : condition has length > 1 , first element used

could please me?

the file name should filename1 <- paste0("a", iter, ".csv"); using 1:22 make 22 file names @ once.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -