lon_lat_from_area {sociome} | R Documentation |
Grab the longitude/latitude of the center of population of a census area
Description
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.
Usage
lon_lat_from_area(geoid = NULL, state = NULL, county = NULL, year = 2020)
Arguments
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. |
Details
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.
Value
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).
See Also
Examples
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")
}