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 -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -