Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session crashes when reading a rectangular IPUMS extract with hipread_list() #2

Open
dtburk opened this issue Jul 13, 2023 · 0 comments

Comments

@dtburk
Copy link
Collaborator

dtburk commented Jul 13, 2023

You can reproduce this bug using the attached file with the following code:

col_spec <- list(
  P = structure(
    list(
      start = c(0, 4, 9, 19, 21, 23, 25, 35), 
      end = c(4, 9, 19, 21, 23, 25, 35, 43), 
      col_names = c(
        "YEAR", "SERIAL", "HWTSUPP", "STATEFIP", "MONTH", "PERNUM", "WTSUPP", 
        "INCTOT"
      ), 
      col_types = c(
        "double", "double", "double", "integer", "integer", "double", "double", 
        "double"
      ), 
      trim_ws = c(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), 
      imp_dec = c(0, 0, 4, 0, 0, 0, 4, 0)
    ), 
    class = c("hip_pos", "tbl_df", "tbl", "data.frame"), 
    row.names = c(NA, -8L)
  )
)

rt_info <- list(start = 0, width = 0, verbose_warning = TRUE)

hipread::hipread_list(
  file = "cps_00006.dat.gz",
  var_info = col_spec,
  rt_info = rt_info,
  encoding = "ISO-8859-1"
)

Sometimes you get an error like

Error in read_list(file, var_names, var_types, rt_info, var_pos_info,  : 
  invalid value

and sometimes your R session crashes.

cps_00006.dat.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant