rpradosiqueira / sidrar

A R interface to IBGE's SIDRA API
87 stars 11 forks source link

get_sidra travando ao tentar recuperar tabelas longas #4

Closed rpsjr closed 6 years ago

rpsjr commented 6 years ago

Rodei o seguinte código:

get_sidra(x = 21, variable = 37, decimais: padrão = 0, máximo = 3 digits = 3, period = "all", geo = "City", header = FALSE, format = 3)

Após isto o R trava e não conclui a função por mais tempo que se espere.

Quando limito o período a um ano tudo ocorre normal.

Para contornar o incidente utilizei o outro seguinte código:

sidar.anos <- c("2001","2002","2003","2004","2005","2006","2007","2008","2009","2010","2011","2012") tbl_sidra_21 <- as_tibble() for(i in 1:length(sidar.anos)) { get_sidra_21 <- get_sidra(x = 21, variable = 37, padrão = 0, máximo = 3 period = sidar.anos[i], geo = "City", header = FALSE, format = 3) tbl_sidra_21 <- dplyr::bind_rows(tbl_sidra_21, as_tibble(get_sidra_21))

O arquivo de diagnóstico do RStudio:

`R version 3.5.0 (2018-04-23) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS High Sierra 10.13.6

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] sidrar_0.2.4 kableExtra_0.9.0 knitr_1.20 bit64_0.9-7 bit_1.1-14 electionsBR_0.3.0 RColorBrewer_1.1-2 maptools_0.9-2 scales_0.5.0
[10] stringi_1.2.2 rgdal_1.3-4 sp_1.2-7 ggmap_2.6.1 readxl_1.1.0 lubridate_1.7.4 data.table_1.11.4 forcats_0.3.0 stringr_1.3.1
[19] dplyr_0.7.5 purrr_0.2.4 readr_1.1.1 tidyr_0.8.1 tibble_1.4.2 ggplot2_3.0.0 tidyverse_1.2.1

SysInfo: sysname "Darwin" release "17.7.0" version "Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64"

R Version: _
platform x86_64-apple-darwin15.6.0
arch x86_64
os darwin15.6.0
system x86_64, darwin15.6.0
status
major 3
minor 5.0
year 2018
month 04
day 23
svn rev 74626
language R
version.string R version 3.5.0 (2018-04-23) nickname Joy in Playing
$__CF_USER_TEXT_ENCODING [1] "0x1F5:0x0:0x47" `

rpradosiqueira commented 6 years ago

Olá @rpsjr,

Infelizmente o SIDRA limita a recuperação dos dados a 10.000 valores, por isso. Para saber quantos valores a sua consulta irá gerar, multiplique a quantidade de seleções feitas em cada uma das dimensões.