Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
daroczig opened this issue Mar 12, 2015 · 4 comments
Closed

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

daroczig opened this issue Mar 12, 2015 · 4 comments
Assignees
Labels
Milestone

Comments

@daroczig
Copy link

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=''?

@arunsrinivasan
Copy link
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.

@daroczig
Copy link
Author

daroczig commented Sep 8, 2015

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

@arunsrinivasan
Copy link
Member

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

@daroczig
Copy link
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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants