Skip to content

fread breaks with reading numeric fields as integer via colClasses #2863

Closed

Description

@renkun-ken

The following examples breaks in the latest release:

library(data.table)

csv <- "
a,b,c
1,2,3.0
2,3,4.5
"

fread(csv, colClasses = c("integer", "integer", "integer"))
   a b             c
1: 1 2 4.658976e-310
2: 2 3 4.658976e-310

It does not work even if c is purely integer but with decimal points:

a,b,c
1,2,3.0
2,3,4.0

My session info:

R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8      
 [8] LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] data.table_1.11.2

loaded via a namespace (and not attached):
[1] compiler_3.4.4 tools_3.4.4   

Activity

  1. added this to the 1.11.6 milestone on Jun 3, 2018
  2. modified the milestones: 1.12.0, 1.11.6 on Jun 6, 2018
  3. modified the milestones: 1.11.6, 1.12.0 on Sep 20, 2018
  4. modified the milestones: 1.12.0, 1.12.2 on Jan 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions