'How to avoid "Error in cachaca(catalog[i, "full_url"], tf, mode = "wb", filesize_fun = "unzip_verify") " when downloading brazilian census microdata?
When using Anthony Joseph Damico`s R infrastructure for Survey Data (http://asdfree.com/), I have encountered some erros when dealing with Brazilian census data. The website provides lines of code of interest here (http://asdfree.com/prerequisites.html) and here (http://asdfree.com/brazilian-censo-demografico-censo.html).
I use the following lines of code to begin downloading census data:
install.packages( "devtools" , repos = "http://cran.rstudio.com/" )
library(devtools)
install_github( "ajdamico/lodown" , dependencies = TRUE )
install.packages( "convey" , repos = "http://cran.rstudio.com/" )
install.packages( "srvyr" , repos = "http://cran.rstudio.com/" )
library(lodown)
lodown( "censo" , output_dir = file.path( path.expand( getwd( ) ) , "CENSO" ) )
This yields the following error:
Error in cachaca(catalog[i, "full_url"], tf, mode = "wb", filesize_fun = "unzip_verify") :
download failed after 3 attempts
Warning in for (i in seq_along(cenv$extra)) { :
closing unused connection 7 (C:/Program Files/R/R-4.1.0/library/lodown/extdata/censo/LE_FAMILIAS.sas)
Warning in for (i in seq_along(cenv$extra)) { :
closing unused connection 6 (C:/Program Files/R/R-4.1.0/library/lodown/extdata/censo/LE_DOMIC.sas)
Warning in for (i in seq_along(cenv$extra)) { :
closing unused connection 5 (C:/Program Files/R/R-4.1.0/library/lodown/extdata/censo/LE_PESSOAS.sas)
Warning in for (i in seq_along(cenv$extra)) { :
closing unused connection 4 (C:/Program Files/R/R-4.1.0/library/lodown/extdata/censo/SASinputDom.txt)
Warning in for (i in seq_along(cenv$extra)) { :
closing unused connection 3 (C:/Program Files/R/R-4.1.0/library/lodown/extdata/censo/SASinputPes.txt)
How can I avoid this? When running the lines of code, a "CENSO" folder is created in my directory. It is, however, empty.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
