get_sidra: Get SIDRA's table

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/get_sidra.R

Description

This function allows the user to connect with IBGE's (Instituto Brasileiro de Geografia e Estatistica) SIDRA API in a flexible way. SIDRA is the acronym to "Sistema IBGE de Recuperação Automática" and it is the system where IBGE makes aggregate data from their researches available.

Usage

1
2
3
get_sidra(x, variable = "allxp", period = "last", geo = "Brazil",
  geo.filter = NULL, classific = "all", category = "all", header = TRUE,
  format = 4, digits = "default", api = NULL)

Arguments

x

A table from IBGE's SIDRA API.

variable

An integer vector of the variables' codes to be returned. Defaults to all variables with exception of "Total".

period

A character vector describing the period of data. Defaults to the last available.

geo

A character vector describing the geographic levels of the data. Defauts to "Brazil".

geo.filter

A (named) list object with the specific item of the geographic level or all itens of a determined higher geografic level. It should be used when geo argument is provided, otherwise all geographic units of 'geo' argument are considered.

classific

A character vector with the table's classification(s). Defaults to all.

category

"all" or a list object with the categories of the classifications of classific(s) argument. Defaults to "all".

header

Logical. should the data frame be returned with the description names in header?

format

An integer ranging between 1 and 4. Default to 4. See more in details.

digits

An integer, "default" or "max". Default to "default" that returns the defaults digits to each variable.

api

A character with the api's parameters. Defaults to NULL.

Details

period can be a integer vector with names "first" and/or "last", or "all" or a simply character vector with date format

The geo argument can be one of "Brazil", "Region", "State", "MesoRegion", "MicroRegion", "MetroRegion", "MetroRegionDiv", "IRD", "UrbAglo", "City", "District","subdistrict","Neighborhood","PopArrang". 'geo.filter' lists can/must be named with the same characters.

When NULL, the arguments classific and category return all options available.

When argument api is not NULL, all others arguments informed are desconsidered

The format argument can be set to:

Value

The function returns a data frame printed by default functions

Author(s)

Renato Prado Siqueira <rpradosiqueira@gmail.com>

See Also

info_sidra

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
## Requesting table 1419 (Consumer Price Index - IPCA) from the API
ipca <- get_sidra(1419,
                  variable = 69,
                  period = c("201212","201401-201412"),
                  geo = "City",
                  geo.filter = list("State" = 50))

## Urban population count from Census data (2010) for States and cities of Southest region.
get_sidra(1378,
          variable = 93,
          geo = c("State","City"),
          geo.filter = list("Region" = 3, "Region" = 3),
          classific = c("c1"),
          category = list(1))
 
## Number of informants by state in the Inventory Research (last data available) 
get_sidra(api = "/t/254/n1/all/n3/all/v/151/p/last%201/c162/118423/c163/0")


## End(Not run)

sidrar documentation built on Aug. 2, 2021, 5:08 p.m.