Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(magrittr)
- library(data.table)
- n_row = seq(1,1e7) %in% sample(1e7,1e5)
- seq <- rle(n_row)
- idx <- c(0, cumsum(seq$lengths))[which(seq$values)] + 1
- indx <- data.frame(start=idx, length=seq$length[which(seq$values)])
- result <- do.call(rbind,apply(indx,1, function(x) return(fread(file,nrows=x[2],skip=x[1],sep=','))))
Advertisement
Add Comment
Please, Sign In to add comment