search for: nooflinetogroup

Displaying 2 results from an estimated 2 matches for "nooflinetogroup".

2012 Jul 24
4
ERROR : cannot allocate vector of size (in MB & GB)
...llocate vector of size 82.4 Mb " My requirement is, spilt data from Huge-size-file(.csv) to no. of small csv files. Here i will give no of lines to be 'split by' as input. Below i give my code ------------------------------- SplitLargeCSVToMany <- function(DataMatrix,Destination,NoOfLineToGroup) { test <- data.frame(read.csv(DataMatrix)) # create groups No.of rows group <- rep(1:NROW(test), each=NoOfLineToGroup) new.test <- cbind(test, group=group) new.test2 <- new.test new.test2[,ncol(new.test2)] <- NULL # now get indices to write out...
2012 Aug 10
1
Split CSV as per file size
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 <- readLines(input, n=NoOfLineToGroup) if (length(myLines) == 0) break writeLines(myLines, sprintf(paste(Destination,"Split_File_%05d.csv"), fileNo)) fileNo...