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] Error message is not displayed when a field ends with percent sign #2287

Closed
etienne-s opened this issue Aug 8, 2017 · 3 comments
Closed

Comments

@etienne-s
Copy link

Minimal example, tested on both CRAN and dev versions:

fread("name,id\nfoo,1\nbar%\n")
# Error in fread("name,id\nfoo,1\nbar%\n") : 
@st-pasha
Copy link
Contributor

st-pasha commented Aug 8, 2017

Could you please provide more details about your system (sessionInfo()). The example that you provided seems to work correctly on my machine:

> fread("name,id\nfoo,1\nbar%\n")
Error in fread("name,id\nfoo,1\nbar%\n") : 
  Line 2 has too few fields when detecting types. Use fill=TRUE to pad with NA. Expecting 2 fields but found 1: <<bar>>

@st-pasha st-pasha added the fread label Aug 8, 2017
@etienne-s
Copy link
Author

sessionInfo()
# R version 3.4.1 (2017-06-30)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# Running under: Windows 7 x64 (build 7601) Service Pack 1
# 
# Matrix products: default
# 
# locale:
# [1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252    LC_MONETARY=French_France.1252
# [4] LC_NUMERIC=C                   LC_TIME=French_France.1252    
# 
# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
# [1] data.table_1.10.5
# 
# loaded via a namespace (and not attached):
# [1] compiler_3.4.1 tools_3.4.1  

If it can help, this is the error I get with a slightly different command:

fread("name,id\nfoo,1\nb%ar\n")
# Error in fread("name,id\nfoo,1\nb%ar\n") : 
#   Line 2 has too few fields when detecting types. Use fill=TRUE to pad with NA. Expecting 2 fields but found 1: <<b0x1.1812000360018p+711r>>

As you can see %a is replaced by 0x1.1812000360018p+711 in the message.

Note: On my Linux system everything works properly.

@st-pasha
Copy link
Contributor

st-pasha commented Aug 9, 2017

Thanks Etienne, this was helpful.
Seems like this problem appears on Windows / MacOS machines only. We'll try to resolve it asap because there appears to be a potential for a crash, not merely a poor error message.

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

3 participants