Skip to content

Control-Z as EOF #1612

@daroczig

Description

@daroczig

Some CSV files generated on MS DOS/Windows, can have ^Z as the end-of-file character as eg at https://www.treasury.gov/ofac/downloads/sdn.csv which results in an error when calling fread:

Expected sep (',') but new line, EOF (or other non printing character) ends field 1 on line 6 when detecting types: ^Z

Removing that character from the end of the file resolves the problem.

Session info:

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 15.10

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] data.table_1.9.4

loaded via a namespace (and not attached):
[1] magrittr_1.5   plyr_1.8.3     tools_3.2.2    reshape2_1.4.1 Rcpp_0.12.3   
[6] stringi_1.0-1  stringr_1.0.0  chron_2.3-47  

But I can reproduce this problem with the most recent dev version of data.table as well at 6f58f5c.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions