Question

Status:Closed    Asked:Jan 28, 2018 - 09:29 PM

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

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?

 
Do you have the same question? Follow this Question
 

Staff Answer

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)

 

Jan 29, 2018 - 08:55 AM

1
0
Report it

OTHER QUESTIONS NEEDING ANSWERS

Why can't I extract the .dat file from the gz file with WinZip?
After i unzipped an extract file, the resulting file did not have a file exte...
i got my data file with zinrar file, i extract the uas_0003.dat file to open...
Are the new R-format files the same as files produced with ipumsr?
Login   |   Register

Recently Active Members

View More »

Share |