lon_lat_from_area | R Documentation |
The user specifies a census area, and the function returns the longitude/latitude coordinates of the area's center of population according to the decennial census.
lon_lat_from_area(geoid = NULL, state = NULL, county = NULL, year = 2020)
geoid |
A single string specifying the geoid of a census area. Must be
2, 5, 11, or 12 digits. Must be |
state |
A single string containing the FIPS code, two-letter
abbreviation, or full state name of a US state or the District of Columbia
or Puerto Rico. Not case sensitive. Must be |
county |
A single string specifying the name of a county in |
year |
One of 2020, 2010, or 2000. Defaults to 2020. |
Centers of population are based on the decennial census. Only states,
counties, tracts, and block groups are currently supported. See the
documentation of the USpopcenters
package and
https://www.census.gov/geographies/reference-files/time-series/geo/centers-population.html
for more information.
Requires the data package USpopcenters
to be installed.
A double vector of length 2. The first element is LONGITUDE (positive for east, negative for west). The second element is LATITUDE (positive for north, negative for south).
areas_in_radius()
if (requireNamespace("USpopcenters", quietly = TRUE)) {
# The center of population of Alaska
lon_lat_from_area(state = "alAskA")
# The center of population of Cook County, Illinois.
lon_lat_from_area(state = "IL", county = "Cook")
# The center of population of some tract in Manhattan
lon_lat_from_area(geoid = "36061021600")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.