ajdamico / asdfree

analyze survey data for free
http://asdfree.com/
GNU General Public License v3.0
609 stars 450 forks source link

Error in read_SAScii_monetdb/rsqlite_send_query while downloading CENSO 2010 #325

Closed lgallindo closed 6 years ago

lgallindo commented 6 years ago

I'm trying to run the proposed code for Brazilian Censo Demografico.

Running

library(lodown)
# examine all available CENSO microdata files
censo_cat <-
  get_catalog("censo" ,
               output_dir = file.path(path.expand("~"), "CENSO"))
# 2010 only
censo_cat <- subset(censo_cat, year == 2010)
# download the microdata to your local computer
lodown("censo", censo_cat)

Gives the error

Error in read_SAScii_monetdb(this_dom, sas_ri = censo_sas(catalog[i, "dom_sas"]),  : 
  Error in rsqlite_send_query(conn@ptr, statement) : 
  near "COPY": syntax error
In addition: Warning message:
Closing open result set, pending rows 

in the very first file - ftp://ftp.ibge.gov.br/Censos/Censo_Demografico_2010/Resultados_Gerais_da_Amostra/Microdados/AC.zip

Session Info is:

R version 3.4.3 Patched (2018-01-16 r74130)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

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] Rcpp_0.12.15      magrittr_1.5      bindr_0.1         knitr_1.18        bit_1.1-12       
 [6] R6_2.2.2          rlang_0.1.6       blob_1.1.0        dplyr_0.7.4       tools_3.4.3      
[11] DBI_0.7           fortunes_1.5-4    yaml_2.1.16       bit64_0.9-7       digest_0.6.14    
[16] assertthat_0.2.0  tibble_1.4.2      bindrcpp_0.2      SAScii_1.0        bitops_1.0-6     
[21] codetools_0.2-15  RCurl_1.95-4.10   memoise_1.1.0     glue_1.2.0.9000   MonetDBLite_0.5.1
[26] RSQLite_2.0       compiler_3.4.3    pillar_1.1.0      pkgconfig_2.0.1  

Any hints on fixing this?

ajdamico commented 6 years ago

sorry i haven't gotten around to fixing this yet. you can use the code in the archive if you need something right away

lgallindo commented 6 years ago

Which code in which archive? :)

ajdamico commented 6 years ago

upper left of asdfree.com