Integer is loaded as double
kadyb opened this issue · 3 comments
kadyb commented
library("vroom")
df = data.frame(x = 1:100)
typeof(df$x)
#> [1] "integer"
tmp = tempfile(fileext = ".csv")
write.csv(df, tmp, row.names = FALSE)
df = vroom(tmp, delim = ",")
typeof(df$x)
#> [1] "double"
df = utils::read.csv(tmp)
typeof(df$x)
#> [1] "integer"
DavisVaughan commented
Interestingly I think vroom actually hardcodes its ability to guess types as integers to false
Line 190 in 3691c68
jennybc commented
From readr v1.2.0 on, readr has never guessed integer https://readr.tidyverse.org/news/index.html?q=guess#readr-120.
And, I assume, vroom simply never guessed integer.
IIRC, in both readr and vroom, if you want integer, you have to specify it explicitly.
jennybc commented
I'm quite sure this is an intentional design decision that came from hard lessons learned in readr.