mnpopcenter / ipumsr

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

Trouble reading micro data #70

Closed l-gorman closed 2 years ago

l-gorman commented 3 years ago

Sorry for the query! I am experiencing some trouble reading micro-data with the ipums package!

Here is my session info:

- Session info -----------------------------------------------------------------------------------
 setting  value                       
 version  R version 4.1.0 (2021-05-18)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_United Kingdom.1252 
 ctype    English_United Kingdom.1252 
 tz       Europe/London               
 date     2021-07-23                  

- Packages ---------------------------------------------------------------------------------------
 package     * version date       lib source        
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.1.0)
 cachem        1.0.5   2021-05-15 [1] CRAN (R 4.1.0)
 callr         3.7.0   2021-04-20 [1] CRAN (R 4.1.0)
 cli           2.5.0   2021-04-26 [1] CRAN (R 4.1.0)
 crayon        1.4.1   2021-02-08 [1] CRAN (R 4.1.0)
 DBI           1.1.1   2021-01-15 [1] CRAN (R 4.1.0)
 desc          1.3.0   2021-03-05 [1] CRAN (R 4.1.0)
 devtools      2.4.2   2021-06-07 [1] CRAN (R 4.1.0)
 dplyr         1.0.7   2021-06-18 [1] CRAN (R 4.1.0)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.1.0)
 fansi         0.5.0   2021-05-25 [1] CRAN (R 4.1.0)
 fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.1.0)
 forcats       0.5.1   2021-01-27 [1] CRAN (R 4.1.0)
 fs            1.5.0   2020-07-31 [1] CRAN (R 4.1.0)
 generics      0.1.0   2020-10-31 [1] CRAN (R 4.1.0)
 glue          1.4.2   2020-08-27 [1] CRAN (R 4.1.0)
 haven         2.4.1   2021-04-23 [1] CRAN (R 4.1.0)
 hms           1.1.0   2021-05-17 [1] CRAN (R 4.1.0)
 ipumsr      * 0.4.5   2020-07-21 [1] CRAN (R 4.1.0)
 lifecycle     1.0.0   2021-02-15 [1] CRAN (R 4.1.0)
 magrittr    * 2.0.1   2020-11-17 [1] CRAN (R 4.1.0)
 memoise       2.0.0   2021-01-26 [1] CRAN (R 4.1.0)
 pillar        1.6.1   2021-05-16 [1] CRAN (R 4.1.0)
 pkgbuild      1.2.0   2020-12-15 [1] CRAN (R 4.1.0)
 pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.1.0)
 pkgload       1.2.1   2021-04-06 [1] CRAN (R 4.1.0)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.1.0)
 processx      3.5.2   2021-04-30 [1] CRAN (R 4.1.0)
 ps            1.6.0   2021-02-28 [1] CRAN (R 4.1.0)
 purrr         0.3.4   2020-04-17 [1] CRAN (R 4.1.0)
 R6            2.5.0   2020-10-28 [1] CRAN (R 4.1.0)
 remotes       2.4.0   2021-06-02 [1] CRAN (R 4.1.0)
 rlang         0.4.11  2021-04-30 [1] CRAN (R 4.1.0)
 rprojroot     2.0.2   2020-11-15 [1] CRAN (R 4.1.0)
 rstudioapi    0.13    2020-11-12 [1] CRAN (R 4.1.0)
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.1.0)
 testthat      3.0.3   2021-06-16 [1] CRAN (R 4.1.0)
 tibble        3.1.2   2021-05-16 [1] CRAN (R 4.1.0)
 tidyselect    1.1.1   2021-04-30 [1] CRAN (R 4.1.0)
 usethis       2.0.1   2021-02-10 [1] CRAN (R 4.1.0)
 utf8          1.2.1   2021-03-12 [1] CRAN (R 4.1.0)
 vctrs         0.3.8   2021-04-29 [1] CRAN (R 4.1.0)
 withr         2.4.2   2021-04-18 [1] CRAN (R 4.1.0)
 zeallot       0.1.0   2018-01-28 [1] CRAN (R 4.1.0)

[1] C:/Users/lgorman/Documents/R/win-library/4.1
[2] C:/Program Files/R/R-4.1.0/library

I am following the example provided in the introduction. I installed the packages. At first I had issues trying to access my data extract, so I decided to run the basic example from the introduction:

cps_ddi <- read_ipums_ddi(ipums_example("cps_00006.xml"))
cps_data <- read_ipums_micro(cps_ddi,verbose = FALSE)

The first line runs fine and gives the following information when viewed in the console:

> cps_ddi
An IPUMS DDI for IPUMS-CPS with 8 variables
Extract 'cps_00006.dat' created on 2017-08-02
User notes:  User-provided description: Minimal test extract
  Samples: 1962, 1963
  Variables: STATEFIP, INCTOT (automatically Year, SERIAL, HWTSUPP, MONTH,
  WTSUPP)
  Select Cases: State - Minnesota, Iowa, Wisconsin, South Dakota, North Dakota

However the second line gives the following error:

Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  function 'Rcpp_precious_remove' not provided by package 'Rcpp'

Interestingly, when I run the second line again, I get no error. The command simply never finishes running. I waited 20 mins for this to finish but it did not happen. I am wondering whether it is normal that it takes this long?

Any guidance would be really appreciated :). Please let me know if you need any further information!

gergness commented 3 years ago

Hi, sorry about that! On stackoverflow, some users report that reinstalling Rcpp solves similar errors in other packages, can you try that? (You could also reinstall ipumsr and hipread for good measure)

https://stackoverflow.com/questions/68416435/rcpp-package-doesnt-include-rcpp-precious-remove