r - 'fread' not compatible with leading/trailing whitespace? -


i trying read text file has columns separated space, in r. tried using data.table since read.csv taking long read. however, first column has leading whitespace , getting following error in fread().
"not positioned correctly after testing format of header row. ch=' '"

the data format similar to,

    45 36 46       45 67 35 

is there way can read using fread() without reformatting textile?

# example reproduces error library(data.table) in.df <- data.frame(a=c(" a1"," b2"," c3"," d4"), b=c(11,22,33,44),                     stringsasfactors=false) write.table(in.df, file="testing.dat", quote=false, row.names=false, col.names=false) test.df <- fread(input="testing.dat", sep=" ", header=false, stringsasfactors=false,                  verbose=true)  # can't find solution in ?fread 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -