Issue with download_extract:

Hello all, I am trying to download the full set of CPS ASECs to study some longitudinal trends in income distributions.

I seem to be able to submit the correct extract successfully. However, when I run the download_extract function, my program downloads the relevant .xml file and “cps_####_varlinks.dat”, but no actual .dat.gz file. If I go to the IPUMS website and see my recent extracts, I can download the .dat.gz file from there no problem to the appropriate directory.

Then I can load the data using read_ipums_micro(data) without issue. If I don’t manually download the data, of course read_ipums_micro returns an error.

Am I doing something wrong? The package documentation for download_extract() suggests that download_extract() returns the filepath for the xml file, but it downloads all corresponding files so that no manual data download is necessary.

My code:

library(ipumsr)

setwd(“myhomedirectory”)

set_ipums_api_key(“my_key”)

years ← 1962:2024
extracts ← paste0(“cps”,years,“_03s”)

sample_extract ← define_extract_micro(collection = “cps”,
description = “This is the universe of ASECs available from IPUMS.”,
samples = extracts,
variables = c(“AGE”,“SEX”,“RACE”,“STATEFIP”, “INCTOT”,“INCWAGE”,“FTOTVAL”),
data_format = “fixed_width”
)

extract ← submit_extract(sample_extract)

extract ← wait_for_extract(extract)

data ← download_extract(
extract,
download_dir = paste0(getwd(),“/raw”),
overwrite = FALSE,
api_key = Sys.getenv(“IPUMS_API_KEY”)

all_asecs ← read_ipums_micro(data)

Same issue here with Python.

Thanks! We were able to replicate this issue on our end as well and are working to resolve it. We share an update once we have more details.

1 Like

Thanks for your patience and for flagging this issue for us. We have resolved the technical issue on our side, and you should now be able to download your extract using ipumsr or ipumspy.

1 Like