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

Parsing bug with quotes when using as.data.frame() in R #8888

Closed
exalate-issue-sync bot opened this issue May 12, 2023 · 2 comments
Closed

Parsing bug with quotes when using as.data.frame() in R #8888

exalate-issue-sync bot opened this issue May 12, 2023 · 2 comments

Comments

@exalate-issue-sync
Copy link

The issue is described here: [https://stackoverflow.com/questions/57309381/as-data-frame-h2oframe-deletes-rows-when-they-contain-a-quote|https://stackoverflow.com/questions/57309381/as-data-frame-h2oframe-deletes-rows-when-they-contain-a-quote]

It works fine when using {{as.h2o()}} to go from data.frame to H2OFrame, but it does not work when going from H2OFrame to data.frame via {{as.data.frame()}}.

{code:r}library(h2o)
h2o.init()
tmp <- data.frame(ngram = c("SIRET:417 653 698",
"SIRET:417 653 698 00031",
"Sans",
"Sans esc.",
"Sans esc. jusqu"au",
"Sans esc. jusqu"au 15.11.2018"))
tmp <- as.h2o(tmp)
tmp <- as.data.frame(tmp)
print(tmp)

ngram

1 SIRET:417 653 698

2 SIRET:417 653 698 00031

3 Sans

4 Sans esc.

5 Sans esc. jusquau\nSans esc. jusquau 15.11.2018{code}

I also tried to see if using data.table as the backend could resolve the issue, but it’s even worse:

{code:r}options("h2o.use.data.table"=TRUE)
tmp <- as.data.frame(tmp)

Warning messages:1: In data.table::fread(ttt, blank.lines.skip = FALSE, na.strings = "", :
Found and resolved improper quoting in first 100 rows. If the fields are not quoted (e.g. field separator does not appear within any field), try quote="" to avoid this warning.
2: In data.table::fread(ttt, blank.lines.skip = FALSE, na.strings = "", :Detected 3 column names but the data has 4 columns (i.e. invalid file). Added 1 extra default column name for the first column which is guessed to be row names or an index. Use setnames() afterwards if this guess is not correct, or fix the file write command that created the file to create a valid file.

dim(tmp)
[1] 1 4
tmp
V1 "Sans esc. jusqu"au"
1 "Sans esc. jusqu"au 15.11.2018"{code}

@exalate-issue-sync
Copy link
Author

Pavel Pscheidl commented: OpenCSV is already built into H2O.

@h2o-ops
Copy link
Collaborator

h2o-ops commented May 14, 2023

JIRA Issue Migration Info

Jira Issue: PUBDEV-6745
Assignee: Pavel Pscheidl
Reporter: Erin LeDell
State: Closed
Fix Version: 3.28.0.3
Attachments: N/A
Development PRs: Available

Linked PRs from JIRA

#4238

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

No branches or pull requests

1 participant