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
read_csv: when the first section of a cell is quoted, the row is not parsed correctly #814
Comments
|
readr assumes the entire field is quoted if any quotes appear. In this case you need to disable quoting by setting readr::read_csv('1,2,3\ncell 1,"cell" 2,"cell 3"\n', quote="")
#> # A tibble: 1 x 3
#> `1` `2` `3`
#> <chr> <chr> <chr>
#> 1 cell 1 "\"cell\" 2" "\"cell 3\""Created on 2018-03-15 by the reprex package (v0.2.0). |
|
Thanks @jimhester. It only seems to assume the field is quoted if a quote appears at the beginning of the cell i.e. I'm trying to read a CSV file with less than ideal quoting i.e. unquoted cell values which themselves contain quotation marks, but I guess the best way will be to EDIT: unfortunately that approach doesn't work as setting |
|
Then you are going to have to preprocess your data in some fashion, we do not support the format you describe. |
|
Thanks for your time, @jimhester. |
|
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
In the examples below, cell 1 is always entirely unquoted, cell 3 is always entirely quoted and cell 2 has a particular section quoted.
If cell 2 has a quoted section at the end or in the middle, the row is parsed correctly.
If cell 2 has a quoted section at the start, the row is not parsed correctly.
Cell 2 should be
"cell" 2and cell 3 should becell 3.The text was updated successfully, but these errors were encountered: