Skip to content

[fread] Error message is not displayed when a field ends with percent sign #2287

Description

@etienne-s

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") : 

Activity

  1. st-pasha commented on Aug 8, 2017

    @st-pasha
    Contributor

    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>>
    
  2. etienne-s commented on Aug 9, 2017

    @etienne-s
    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.

  3. st-pasha commented on Aug 9, 2017

    @st-pasha
    Contributor

    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.

  4. added this to the milestone on Aug 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions