# Error using extract

**URL:** <https://forum.ipums.org/t/error-using-extract/3091>\
**Category:** ipumsr\
**Created:** [July 15, 2019, 5:24pm UTC](https://forum.ipums.org/t/error-using-extract/3091 "2019-07-15T17:24:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pumitas](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@pumitas](https://forum.ipums.org/u/pumitas)\
**Post date:** [July 15, 2019, 5:24pm UTC](https://forum.ipums.org/t/error-using-extract/3091/1 "2019-07-15T17:24:52Z")

</div>

Hello,

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:

```auto
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:

```auto
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…

---

<div class="post-metadata">

**Author:** ![JeffBloem](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.ipums.org/jeffbloem/32/40_2.png) [@JeffBloem](https://forum.ipums.org/u/JeffBloem)\
**Post date:** [July 17, 2019, 2:23pm UTC](https://forum.ipums.org/t/error-using-extract/3091/2 "2019-07-17T14:23:22Z")

</div>

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 [ipums@umn.edu](mailto:ipums@umn.edu)? 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).

---

<div class="post-metadata">

**Author:** ![pumitas](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@pumitas](https://forum.ipums.org/u/pumitas)\
**Post date:** [July 18, 2019, 4:24pm UTC](https://forum.ipums.org/t/error-using-extract/3091/3 "2019-07-18T16:24:39Z")

</div>

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