Skip to content

fread fails with double quotes at the beginning of a field #1077

Closed

Description

@daroczig

The CRAN (1.9.4) version of data.table silently ignores this issue and returns and empty object:

fread('2,3\n""foo,bar')
## Empty data.table (0 rows) of 1 col: "foo,bar

The development version (32975cd) fails with an error:

fread('2,3\n""foo,bar')
## Error in fread("2,3\n\"\"foo,bar") : 
##   Field 1 on line 2 starts with quote (") but then has a problem. It can contain balanced unescaped quoted subregions but if it does it can't contain embedded \n as well. Check for unbalanced unescaped quotes: ""foo,bar

I'm aware of the fact that this "CSV" is not well formed, but that's what I get :( Is there a way to sepcify something like quote=''?

Activity

  1. added this to the v1.9.6 milestone on Sep 7, 2015
  2. arunsrinivasan commented on Sep 8, 2015

    @arunsrinivasan
    Member

    Thanks for the report. quote = "" is implemented. Either use that, or wrap your file with "" around character columns so that quote = "\"" can then read it properly. See ?fread quote argument.

  3. daroczig commented on Sep 8, 2015

    @daroczig
    Author

    Awesome, thank you very much, @arunsrinivasan & keep up the good work 💯

  4. arunsrinivasan commented on Sep 16, 2015

    @arunsrinivasan
    Member

    Removed quote argument with a better fix (slightly more robust) for quotes. Please upgrade and test.

  5. daroczig commented on Sep 16, 2015

    @daroczig
    Author

    Thanks! For the record, related commit: 9cb1f60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions