Ability to export lines fread thinks are incorrectly classed
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start with fread on input containing broken rows and inspect how it reports coercion, empty-line, and incorrectly classified-line warnings. Define the export format and configurable preceding/following context, then verify that all detected lines and their numbers are reported without losing the existing diagnostics; also assess the strip.white and blank.lines.skip behavior described for data.table 1.10.4.
Written by the indexing model from the issue text.
Description
I've been really impressed with data.table, not just the speed but the fact the error messages are actually useful.
I was working with ~350 FDA files amounting to ~127 million lines and continually encountering coercion issues with some of the columns. It turns out numerous lines within the originals break across two rows. I can only image this is some form of encoding issue when they were originally being generated; I've tried re-downloading and unpacking them multiple times and its been a persistent issue.
There only seem to be five or ten per file but that's potentially 1,500 to 3,500 lines that would need to be manually edited; I actually set out to do with this with readLines, opening the result on notepad++ to check it, trying the import again, fixing the next ones, checking it etc, but rapidly began to give up the will to live and had to abandon ship. It also significantly reduces the otherwise excellent performance of a fully fread'ed section of code.
At present, fread will report the first one it identifies. It'd be really useful if there was an option to export all of the lines it thinks are incorrectly classified with the associated line numbers for reference. It'd also be good if that option allowed users to specify how many previous and subsequent lines to include in the warning report; e.g. if fread finds one, get the line before and the line after as well to see what's going on with it.
Perhaps it'd be possible to implement some form of error correction. In this case, the only issue with the lines is they need a backspace applying to the start of them.
I've also noticed with the same files in data.table 1.10.4 that 'strip.white = TRUE' seems to produce empty line errors for almost every one of the FDA files I try to import, on entirely different lines, with blank.lines.skip = TRUE.
I've manually checked many of those lines and there aren't any empty lines present. I'm not sure if it might be worth including a suggestion to disable strip white in the warning for them. As for the broken line check, maybe it be useful if fread printed the previous and next few lines after an empty line warning to quickly check if there is actually a blank there at the console.
- Dominant language
- R
- Stars
- 3.9k
- Forks
- 1.1k
- Avg merge
- 14h 4m
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Rdatatable/data.table
-
as.data.table() recurses without end on a survival::Surv object (or any data.frame carrying one) Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Rdatatable/data.table#7887 ·
-
consistency tests
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Rdatatable/data.table#7853 · 3 comments ·
-
internals
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Rdatatable/data.table#6938 · 1 comment ·
-
encoding fread
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Rdatatable/data.table#5179 · 8 comments ·
-
documentation programming
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Rdatatable/data.table#3199 · 3 comments ·
All issues in Rdatatable/data.table
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
r-lib/pkgdepends#485 · 3 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
beginners blocker
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enviPathR OpenBuild Error Build OK Build Warning policies-accepted pre-review precheck-passed
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Bioconductor/BiocContributions#207 · 6 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
datacarpentry/semester-biology#1255 ·