Package 'sidrar'

Title: An Interface to IBGE's SIDRA API
Description: Allows the user to connect with IBGE's (Instituto Brasileiro de Geografia e Estatistica, see <https://www.ibge.gov.br/> for more information) SIDRA API in a flexible way. SIDRA is the acronym to "Sistema IBGE de Recuperacao Automatica" and is the system where IBGE turns available aggregate data from their researches.
Authors: Renato Prado Siqueira [aut, cre]
Maintainer: Renato Prado Siqueira <[email protected]>
License: GPL-3
Version: 0.2.9
Built: 2024-10-30 02:59:59 UTC
Source: https://github.com/rpradosiqueira/sidrar

Help Index


Get SIDRA's table

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

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:

  • 1: Return only the descriptors' codes

  • 2: Return only the descriptor's names

  • 3: Return the codes and names of the geographic level and descriptors' names

  • 4: Return the codes and names of the descriptors (Default)

Value

The function returns a data frame printed by default functions

Author(s)

Renato Prado Siqueira [email protected]

See Also

info_sidra

Examples

## 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)

Listing all the parameters of a SIDRA's table

Description

It returns the parameters and their descriptions of a SIDRA's table.

Usage

info_sidra(x, wb = FALSE)

Arguments

x

A table from SIDRA's API.

wb

Logical. Should the metadata be open in the web browser? Default to FALSE.

Value

A list with the all table's parameters.

Author(s)

Renato Prado Siqueira [email protected]

See Also

get_sidra

Examples

## Not run: 
info_sidra(1419)

## End(Not run)

Search SIDRA's tables with determined term(s)

Description

It returns all SIDRA's tables with determined term

Usage

search_sidra(x)

Arguments

x

A character vector with the term(s)/word(s) to search.

Value

A character vector with the tables' names.

Author(s)

Renato Prado Siqueira [email protected]

See Also

get_sidra

Examples

## Not run: 
search_sidra("contas nacionais")

## End(Not run)