get_brazil_municipality()
returns a tibble
with data
about Brazilian municipalities.
Note: This function requires an internet connection to work and the
geobr
or
geocodebr
package to be
installed, depending on the chosen method for retrieving coordinates.
Usage
get_brazil_municipality(
municipality = NULL,
state = NULL,
year = as.numeric(substr(Sys.Date(), 1, 4)),
coords_method = "geobr",
force = FALSE
)
Arguments
- municipality
(optional) A
character
vector with the name of the municipalities. IfNULL
the function returns all municipalities (default:NULL
).- state
(optional) A
character
vector with the name of the states (default:NULL
).- year
(optional) An
integerish
number indicating the year of the data regarding the municipalities (default:Sys.Date() |> substr(1, 4) |> as.numeric()
).- coords_method
(optional) A string indicating the method to retrieve the latitude and longitude coordinates of the municipalities. Options are:
"geobr"
: Usesread_municipal_seat()
from thegeobr
package to retrieve the coordinates."geocodebr"
: Uses thegeocode()
from thegeocodebr
package to retrieve the coordinates. (default:"geobr"
).
- force
(optional) A
logical
flag indicating whether to force the download of the data again (default:FALSE
).
Value
A tibble
with the following columns:
region_code
: The region code.region
: The region name.state_code
: The state code.state
: The state name.federal_unit
: The state abbreviation.municipality_code
: The municipality code.municipality
: The municipality name.latitude
: The municipality latitude.longitude
: The municipality longitude.
Details
The data from this function is based on data from the Brazilian Institute
of Geography and Statistics (IBGE) via the
geobr
and geocodebr
R packages.
Both packages are produced by Brazil's Institute for Applied Economic Research (IPEA) and access the Brazilian Institute of Geography and Statistics (IBGE) data.
See also
Other Brazil functions:
get_brazil_fu()
,
get_brazil_municipality_code()
,
get_brazil_municipality_coords()
,
get_brazil_municipality_latitude()
,
get_brazil_municipality_longitude()
,
get_brazil_region()
,
get_brazil_region_code()
,
get_brazil_state()
,
get_brazil_state_by_utc()
,
get_brazil_state_capital()
,
get_brazil_state_code()
,
get_brazil_state_latitude()
,
get_brazil_state_longitude()
,
render_brazil_address()