You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fread fails if whitespace before first character #1035
I first tried with the stable version (1.9.4) and got the following error:
Expected sep (',') but new line, EOF (or other non printing character) ends field 1 on line 4 when detecting types: 0 3.95527E+01 2.10651E+01
with the development version (1.9.5) I get the following error:
Not positioned correctly after testing format of header row. ch=' '
This seems like it would be resolved by #758 or #558 (variable whitespace delimiter)
but just wanted to give another example of a situation where fread currently fails and need to fall back to read.table(sep="") to get the table to read in properly
I am experiencing a similar problem; however, the R session completely aborts in 1.9.4, instead of giving a warning message.
Here is an example illustrating the format of dataset with which I am working:
" 22 4 6 4"
" 34 22 34 5"
" 6 2 1 4"
Each row begins with two white spaces, but the separator for the rest of the values is a single white space.
In version 1.9.4, when I attempted to use fread() in RStudio with my much-larger dataset, I received the following pop-up warning (and the session had to be restarted):
R Session Aborted
R encountered a fatal error. The session was terminated.
Using version 1.9.5, I instead received this error message:
Not positioned correctly after testing format of header row. ch=' '
I found this output very confusing, since I had specified that there was no header row (header = FALSE). The verbose=TRUE version of this output is below.
Input contains no \n. Taking this to be a filename to open
File opened, filesize is 0.024641 GB.
Memory mapping ... ok
Detected eol as \r\n (CRLF) in that order, the Windows standard.
Positioned on line 1 after skip or autostart
This line is the autostart and not blank so searching up for the last non-blank ... line 1
Detecting sep ... ' '
Detected 561 columns. Longest stretch was from line 1 to line 30
Starting data input on line 1 (either column names or first row of data). First 10 characters: 2.571777
Error in fread("UCI HAR Dataset/test/X_test.txt", header = FALSE, verbose = TRUE) :
Not positioned correctly after testing format of header row. ch=' '
I am using R version 3.20 ("Full of Ingredients"), with RStudio version 0.98.1103.
but reading the same file with fread does not work and throws me an error:
> dt <- fread("./data/train/X_train.txt")
Error in fread("./data/train/X_train.txt") :
Not positioned correctly after testing format of header row. ch=' '
Activity
GHarmata commentedon Jun 9, 2015
I am experiencing a similar problem; however, the R session completely aborts in 1.9.4, instead of giving a warning message.
Here is an example illustrating the format of dataset with which I am working:
Each row begins with two white spaces, but the separator for the rest of the values is a single white space.
In version 1.9.4, when I attempted to use fread() in RStudio with my much-larger dataset, I received the following pop-up warning (and the session had to be restarted):
Using version 1.9.5, I instead received this error message:
Not positioned correctly after testing format of header row. ch=' 'I found this output very confusing, since I had specified that there was no header row (header = FALSE). The verbose=TRUE version of this output is below.
I am using R version 3.20 ("Full of Ingredients"), with RStudio version 0.98.1103.
jaapwalhout commentedon Jul 28, 2015
I had the same problem. This works:
but reading the same file with
freaddoes not work and throws me an error:The file in question can be downloaded from here (66MB's).
gains strip.white' arg. Closes #1113, #1035, #1000, #785 and #529.
arunsrinivasan commentedon Sep 16, 2015
Fixed in devel. Please upgrade and test.
jaapwalhout commentedon Sep 16, 2015
@arunsrinivasan Tested. It now works on the file I specified above.