mnpopcenter / ipumsr

Read IPUMS data into R.
http://tech.popdata.org/ipumsr
Mozilla Public License 2.0
89 stars 8 forks source link

Remove pillar printing from ipumsr (fixes #40) #47

Closed gergness closed 4 years ago

gergness commented 5 years ago

Overwriting the pillar method from haven is necessary because of a bug in haven, which will be fixed when https://github.com/tidyverse/haven/pull/425 is incorporated into a CRAN release by the tidyverse team.

Until then, the warning that comes with R 3.6:

library(ipumsr)
#> Registered S3 methods overwritten by 'ipumsr':
#>   method                                 from 
#>   format.pillar_shaft_haven_labelled_chr haven
#>   format.pillar_shaft_haven_labelled_num haven
#>   pillar_shaft.haven_labelled            haven

is preferable to not being able to print the data under some circumstances.

After, you can merge this pull request and release to CRAN.

The bug in haven is:

library(haven)
library(tibble)

x <- haven::labelled(1:2, c("label" = 1, "label" = 2))
tibble(x = x)
#> Error in `levels<-`(`*tmp*`, value = as.character(levels)): factor level [2] is duplicated

Created on 2019-05-13 by the reprex package (v0.2.1)

dtburk commented 4 years ago

@gergness Would you recommend revising Imports to require haven > 2.2.0 as part of merging this pull request?

gergness commented 4 years ago

Yep, that makes sense to me