Re: [R] Split CSV as per file size

2012-08-28 Thread Rantony
But here, I need to split the csv file by giving file-size(in KB) as input. It required to split as per size(in KB), instead of giving no. of files. Suppose, even if the file size ends in the middle of the last line, it should include the complete last line. For eg: NAME AGE PLACE A

[R] Split CSV as per file size

2012-08-10 Thread Rantony
Hi here i have a code to split a csv file as per group of line. The code given below, SplitCSVByLine <- function(DataMatrix,Destination,NoOfLineToGroup) { input <- file(DataMatrix, "r") fileNo <- 1 repeat { myLines

Re: [R] Split CSV as per file size

2012-08-10 Thread Bharat Warule
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} rea