get_tc_municipios: Get municipality dictionary

View source: R/transferencias.R

get_tc_municipiosR Documentation

Get municipality dictionary

Description

Retrieves the dictionary of municipalities and their numeric codes. Use these codes in the p_municipio / municipality parameter of other functions.

Usage

get_tc_municipios(
  p_nome = NULL,
  p_uf = NULL,
  use_cache = TRUE,
  verbose = FALSE
)

get_tc_municipalities(name = NULL, state_code = NULL,
  use_cache = TRUE, verbose = FALSE)

Arguments

p_nome

Character. Partial municipality name for searching (e.g., "Recife"). Optional.

p_uf

Numeric or character. State code from get_tc_estados(). Not a state abbreviation or IBGE code. Optional.

use_cache

Logical. If TRUE (default), uses an in-memory cache.

verbose

Logical. If TRUE, prints the full API URL being called. Useful for debugging or testing in a browser. Defaults to getOption("tesouror.verbose", FALSE).

name

Character. Partial municipality name for searching (e.g., "Recife"). Optional. Maps to p_nome.

state_code

Numeric or character. State code from get_tc_estados(). Not a state abbreviation or IBGE code. Optional. Maps to p_uf.

Details

These are internal Treasury codes, not IBGE codes. Filter by state using the numeric code from get_tc_estados().

get_tc_municipalities() is an English alias.

Value

A tibble with municipality data including codigo, codigo_uf, and nome.

See Also

Other Transferencias: get_tc_estados(), get_tc_por_estados(), get_tc_por_estados_detalhe(), get_tc_por_municipio(), get_tc_por_municipio_detalhe(), get_tc_transferencias()

Other Transferencias dictionaries: get_tc_estados(), get_tc_transferencias()

Examples

## Not run: 
# Step 1: find the state code (Treasury code, NOT IBGE)
estados <- get_tc_estados()
pe_code <- estados$codigo[estados$nome == "Pernambuco"]

# Step 2: list municipalities for that state
municipios <- get_tc_municipios(p_uf = pe_code)

# Or search by partial name
recife <- get_tc_municipios(p_nome = "Recife")

## End(Not run)

tesouror documentation built on May 7, 2026, 1:06 a.m.