files <- sample(list.files("/full/path/", full.names=T, pattern = "*[1-9]"),2) library(doParallel) library(plyr) registerDoParallel(cores = 4) library(foreach) data2 <- foreach(i = files, .combine = rbind, stringsAsFactors = default.stringsAsFactors(), factor.exclude = NA) %dopar% read.table(i, sep = " ", fill = TRUE, **skipNul = TRUE**, header = FALSE)
I'm trying to invoke doparallel around read.table, primarily because I want the skipNul functionality to shift the columns in data to the left based on the presence of whitespace. the source files are space delimited already, but when it comes to the date stamp in the file with single digit dates, its treating that as nul space and shifting the data to the right and offsetting the values of my table. If I invoke a single file using read.table, this solves the issue but I'm losing something in doing this through doparallel. I'm presuming this is because of how rbind is working to concat the files. Any help on a better way to do this would be very much appreciated!