[R] Split CSV as per file size

Bharat Warule bwarule at gmail.com
Fri Aug 10 12:12:00 CEST 2012


check this! if it helps!

read_data <- read.csv(DataMatrix)
length <- dim(read_data)[1]
no_of_files <-  10 ##user define
file_no_itr <- length/no_of_files

for(i in 1:no_of_files){
	e_l <- i*file_no_itr
    s_l <- 1 + (i-1)* file_no_itr
	if(i==no_of_files){ e_l <- length}
	read_data_new <- read_data[s_l:e_l,]
	newname <- paste("read_data",i,sep="_")
	assign(read_data_new,newname)
	### write ur output data code 
	}



-----
Bharat Warule 
Cypress Analytica ,
Pune
--
View this message in context: http://r.789695.n4.nabble.com/Split-CSV-as-per-file-size-tp4639880p4639883.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list