R package 'ipums' can't read extract. Needs .XML file? No option for that???


#1

Trying to use the ipumsr package in R to read a CPS extract file. Seems to need an extract file with .XML extension. That format is not presented as an option. Using the .dat or the .dat.gz files do not work. What to do?


#2

I think the issue may be that you attempted to read in a .csv file. According to the documentation, you should rely on the zipped .dat file as well as the .xml DDI file (found under “Codebook” in your list of extracts). Additionally, make sure you save both files to your working directory.

If you have the correct files and they are in the correct location, the following code will work (keep in mind that what I have as “cps_XXXXX.xml” should be changed to match the name of your extract).

cps_data <- “cps_XXXXX.xml”
ddi <- read_ipums_ddi(cps_data)
data <- read_ipums_micro(ddi)