Closed joshcolston closed 11 months ago
Hello, I have a similar problem. Here are the details:
> library(lodown)
> lodown("censo" , output_dir = file.path(path.expand("~") , "CENSO"))
building catalog for censo
locally downloading censo
downloading from URL
'ftp://ftp.ibge.gov.br/Censos/Censo_Demografico_2000/Microdados/AC.zip'
to file
'C:\Users\vinic\AppData\Local\Temp\RtmpwjoayT\fileb1c43e812fe'
download issue with
'ftp://ftp.ibge.gov.br/Censos/Censo_Demografico_2000/Microdados/AC.zip'
download issue with
'ftp://ftp.ibge.gov.br/Censos/Censo_Demografico_2000/Microdados/AC.zip'
download issue with
'ftp://ftp.ibge.gov.br/Censos/Censo_Demografico_2000/Microdados/AC.zip'
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=Portuguese_Brazil.1252 LC_CTYPE=Portuguese_Brazil.1252
[3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Brazil.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lodown_0.1.0
loaded via a namespace (and not attached):
[1] httr_1.4.0 compiler_3.6.0 R6_2.4.0 tools_3.6.0 RCurl_1.95-4.12
[6] curl_3.3 digest_0.6.20 bitops_1.0-6
lodown is now exiting unexpectedly.
websites that host publicly-downloadable microdata change often and sometimes those changes cause this software to break.
if the error call stack below appears to be a hiccup in your internet connection, then please verify your connectivity and retry the download.
otherwise, please open a new issue at `https://github.com/ajdamico/asdfree/issues` with the contents of this error call stack and also the output of your `sessionInfo()`.
[[1]]
lodown("censo", output_dir = file.path(path.expand("~"),
"CENSO"))
[[2]]
withCallingHandlers(catalog <- load_fun(data_name = data_name,
catalog, ...), error = function(e) {
print(sessionInfo())
if (grepl("cannot allocate vector of size", e))
message(memory_note)
else if (grepl("parameter must be specified", e))
message(parameter_note)
else if (grepl("to install", e))
message(installation_note)
else {
message(unknown_error_note)
print(sys.calls())
}
})
[[3]]
load_fun(data_name = data_name, catalog, ...)
[[4]]
cachaca(catalog[i, "full_url"], tf, mode = "wb")
[[5]]
httr_filesize(this_url, attempts, sleepsec)
[[6]]
stop(paste0("httr::HEAD( '", url, "' )\nfailed after ",
initial.attempts, " attempts"))
[[7]]
.handleSimpleError(function (e)
{
print(sessionInfo())
if (grepl("cannot allocate vector of size", e))
message(memory_note)
else if (grepl("parameter must be specified", e))
message(parameter_note)
else if (grepl("to install", e))
message(installation_note)
else {
message(unknown_error_note)
print(sys.calls())
}
}, "httr::HEAD( 'ftp://ftp.ibge.gov.br/Censos/Censo_Demografico_2000/Microdados/AC.zip' )\nfailed after 3 attempts",
base::quote(httr_filesize(this_url, attempts, sleepsec)))
[[8]]
h(simpleError(msg, call))
Error in httr_filesize(this_url, attempts, sleepsec) :
httr::HEAD( 'ftp://ftp.ibge.gov.br/Censos/Censo_Demografico_2000/Microdados/AC.zip' )
failed after 3 attempts
I believe I have identified the problem: lodown
tries to use httr::HEAD
to an ftp server, which is unsupported.
I think if you modified the function to use download.file
in this case it should work.
EDIT:
I've checked the code to cachaca
and it seems to check for the need to use RCurl
instead of httr in the case of ftps, so I've no idea why the error mentions the use of httr::HEAD
.
hi! apologies for the long delay. i've made a couple of big updates to asdfree.com that hopefully make the website a bit better, but i've decided to stop maintaining the lodown package so probably won't fix the bug you've reported. the new asdfree doesn't have censo data yet, but it's on my to-do list. thanks
Hi!
Thank you for the reply. Eventually someone will tackle the almighty task of making Brazilian Census data accessible easily accessible to R users. Currently it requires a good deal of hacking and bespoke solutions.
Best, Vinicius
Den tis 9 jan. 2024 02:51Anthony Damico @.***> skrev:
hi! apologies for the long delay. i've made a couple of big updates to asdfree.com that hopefully make the website a bit better, but i've decided to stop maintaining the lodown package so probably won't fix the bug you've reported. the new asdfree doesn't have censo data yet, but it's on my to-do list. thanks
— Reply to this email directly, view it on GitHub https://github.com/ajdamico/lodown/issues/154#issuecomment-1882149341, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIZRXDQEYBMY7SP3XULPO4LYNSPD3AVCNFSM4HZCQTHKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBYGIYTIOJTGQYQ . You are receiving this because you commented.Message ID: @.***>
Hello,
I would like to analyse the Brazil 2000 and 2010 Census data using Stata and I came across these instructions here http://asdfree.com/brazilian-censo-demografico-censo.html
When I run the lodown command, it creates the 2000 and 2010 folders in the CENSO folder, but it does not download any microdata to them. Do you have any suggestions? The following error message came up:
Error in httr_filesize(this_url, attempts, sleepsec) : httr::HEAD( 'ftp://ftp.ibge.gov.br/Censos/Censo_Demografico2000/Microdados/AC.zip' ) failed after 3 attempts In addition: Warning messages: 1: In tryCatch(if (missE) ...elt(i) else eval(cl.i, envir = envir), : closing unused connection 7 (C:/Users/josh/Documents/R/win-library/3.5/lodown/extdata/censo/LEFAMILIAS.sas) 2: In tryCatch(if (missE) ...elt(i) else eval(cl.i, envir = envir), : closing unused connection 6 (C:/Users/josh/Documents/R/win-library/3.5/lodown/extdata/censo/LEDOMIC.sas) 3: In tryCatch(if (missE) ...elt(i) else eval(cl.i, envir = envir), : closing unused connection 5 (C:/Users/josh/Documents/R/win-library/3.5/lodown/extdata/censo/LEPESSOAS.sas) 4: In tryCatch(if (missE) ...elt(i) else eval(cl.i, envir = envir), : closing unused connection 4 (C:/Users/josh/Documents/R/win-library/3.5/lodown/extdata/censo/SASinputDom.txt) 5: In tryCatch(if (missE) ...elt(i) else eval(cl.i, envir = envir), : closing unused connection 3 (C:/Users/josh_/Documents/R/win-library/3.5/lodown/extdata/censo/SASinputPes.txt)