csvy
csvy copied to clipboard
Character vectors lose leading zeroes
Please specify whether your issue is about:
- [x] a possible bug
- [ ] a question about package functionality
- [ ] a suggested code or documentation change, improvement to the code, or feature request
Writing and reading seem to mess up character vectors with leading zeroes.
data <- data.frame(x = 1, y = c("10", "05"))
file <- tempfile()
csvy::write_csvy(data, file, name = "abc")
csvy::read_csvy(file)
#> x y
#> 1 1 10
#> 2 1 5
str(csvy::read_csvy(file))
#> 'data.frame': 2 obs. of 2 variables:
#> $ x: num 1 1
#> $ y: chr "10" "5"
#> ..- attr(*, "levels")= chr "05" "10"
#> - attr(*, "profile")= chr "tabular-data-package"
#> - attr(*, "name")= chr "abc"
Created on 2019-12-16 by the reprex package (v0.3.0)
read_csvy does not use the fields metadata at all when reading columns: https://github.com/leeper/csvy/blob/master/R/read_csvy.R#L68C1-L71C6