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 to read entire file and does *not* throw warning nor error #1095

Closed
rsaporta opened this issue Mar 26, 2015 · 4 comments
Closed
Assignees
Labels
Milestone

Comments

@rsaporta
Copy link
Contributor

sample data available here: http://www.state.nj.us/transportation/refdata/accident/2013/Monmouth2013Accidents.zip

Offending line (767 in linked file) has the following value: ""A"" ST

Compare to read.table:

f <- "Monmouth2013Accidents.txt"
ans1 <- fread(f)
ans2 <- as.data.table(read.table(f, header=FALSE, sep=",", comment.char="", quote="", stringsAsFactors=FALSE))

dim(ans1)
# [1] "766 rows X 47 cols"
dim(ans2)
# [1] "20,700 rows X 47 cols"`

possibly related to #1077.

@arunsrinivasan
Copy link
Member

I get this with v1.9.5:

# Error in fread(f) : 
#   Field 48 on line 767 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: 
# ""A"" ST                           , ,                         ,  ,25,25,        ,        ,
# N,                                                                                ,614  

@rsaporta
Copy link
Contributor Author

great! Why the restriction on \n if only an ending character?
Any concern with the difference with read.table() ?

@arunsrinivasan arunsrinivasan self-assigned this Sep 7, 2015
@arunsrinivasan arunsrinivasan added this to the v1.9.6 milestone Sep 7, 2015
@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.

@arunsrinivasan
Copy link
Member

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

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