
Get Brazilian municipalities longitude
Source:R/get_brazil_municipality_longitude.R
get_brazil_municipality_longitude.Rd
get_brazil_municipality_longitude()
returns the longitude of Brazilian
municipalities.
Arguments
- municipality_code
An
integerish
vector with the IBGE codes of Brazilian municipalities. Useget_brazil_municipality_code()
to obtain codes from municipality names and states.- year
(optional) An
integerish
number indicating the year of the data regarding the municipalities (default:Sys.Date() |> lubridate::year()
).- 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"
).
- names
(optional) A
logical
flag indicating whether to return the names of the municipalities as names of the vector (default:TRUE
).- ...
(optional) Additional arguments passed to
get_brazil_municipality()
.
Value
A numeric
vector with the longitude of the
Brazilian municipalities.
Details
The data from this function is based on data from the Brazilian Institute
of Geography and Statistics (IBGE) via the
geobr
R package.
The geobr
package is produced by Brazil's Institute for
Applied Economic Research (IPEA) and access the
Brazilian Institute of Geography and Statistics (IBGE) data. You can see a
list of all geobr
datasets by running
geobr::list_geobr()
.
See also
Other Brazil functions:
get_brazil_fu()
,
get_brazil_municipality()
,
get_brazil_municipality_code()
,
get_brazil_municipality_coords()
,
get_brazil_municipality_latitude()
,
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()
Examples
get_brazil_municipality_longitude(3550308)
#> São Paulo-SP
#> -46.57038
get_brazil_municipality_longitude(c(3550308, 3500204))
#> São Paulo-SP Adolfo-SP
#> -46.57038 -49.64972
get_brazil_municipality_longitude(c(3550308, 1000, 3500204))
#> São Paulo-SP <NA> Adolfo-SP
#> -46.57038 NA -49.64972
get_brazil_municipality_longitude(c(3550308, NA, 3500204))
#> São Paulo-SP <NA> Adolfo-SP
#> -46.57038 NA -49.64972