Carlo
Carlo

Reputation: 161

Error in fread{data.table}

I'm trying to read a txt file using fread{data.table) but I get an error

(Error in fread(filename, h = F, sep = ";", nrows = 81, skip = 168, verbose = T) : 
' ends field 1 on line 168 when detecting types: Iteration 27)

The file is available at:

https://www.dropbox.com/s/1ybznmh63qjfaij/test.txt?dl=0

I'm using the commands:

filename="test.txt"
require(data.table)
tyr <- fread(filename, h=F, sep=";", nrows=81, skip=168, verbose=T)

I can read the file fine with

tyr <- fread(filename, h=F, sep=";", nrows=15, skip=168, verbose=T)

and I can read the file fine if I open it in a text editor (Notepad++), cut the first 167 lines, re-save it as plain txt and use:

tyr <- fread(filename, h=F, sep=";", nrows=81, skip=1, verbose=T)

Lastly, I can read the file fine using the equivalent call with read.table. I don't understand what fread is looking in line 168 since I said to skip it. The file is a standard output file from a software and each datablock is identically formatted, yet I can read the previous data block fine with:

tyr <- fread(filename, h=F, sep=";", nrows=81, skip=86, verbose=T)

I'd appreciate any help in understanding what's going on.

Thanks, carlo

Upvotes: 4

Views: 2599

Answers (1)

MichaelChirico
MichaelChirico

Reputation: 34763

It appears this question was closed through this issue (fixing commit unknown):

https://github.com/Rdatatable/data.table/issues/801

Upvotes: 0

Related Questions