Error using extract


I am trying to import an extract in r using the ipumsr package. I’ve downloaded the data in .dta and .dat format with the same results. This is the error I am getting:

Error in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else paste0(labels,  : 
  factor level [225] is duplicated

Here’s the code I’m using to import the file:

usa_ddi <- read_ipums_ddi("usa_00006.xml")
usa_data <- read_ipums_micro(usa_ddi, verbose = FALSE)

My extract has the following variables, besides the ones that get added automatically: CITY, RACE, HISPAN, OCC, IND, EDUC, LABFORCE, INCTOT. It samples from the 5% ACS 2017 and 2000 census.

If anyone has any clue how I could fix this, I’m all ears. I’ve updated ipumsr to no avail, and didn’t seem to run into this issue before…

Thanks for the note. This looks like a bug that was fixed in ipumsr version 0.4.1. So, the first detail to check is to make sure that you are using version 0.4.1 or 0.4.2 of ipumsr. You can check the version number with the command packageVersion(“ipumsr”).

If you are already using ipumsr version 0.4.1 or 0.4.2, could you share the .xml file you are using with us by emailing If you are using ipumsr version 0.4.0 or lower, you can run the command install.packages(“ipumsr”), which will install the most up-to-date version of the package on CRAN (0.4.2).

I upgraded to 0.4.1 and this seems to have fixed it! Thank you.