Learn R Programming

USAboundaries (version 0.4.0)

us_cities: City locations and populations (historical and contemporary)

Description

This function returns an sf object of cities (or populated places) with their populations and latitudes and longitudes. Population data is taken from the U.S. Census.

Usage

us_cities(map_date = NULL, states = NULL)

Arguments

map_date

If NULL, then city populations from the 2010 census (the most recent census) are returned. This parameter accepts a Date object or a character string coercible to a Date object, as well as numeric values representing a year. If a year or date is used, then city populations from the decennial census from 1790 to 2010 prior to that year is returned. For example, 1805 or "1805-07-04" would return city populations from the 1800 census.

states

A character vector of state or territory names or abbreviations. Only boundaries for those states/territories will be returned. If NULL, all boundaries will be returned.

References

The data was compiled by Erik Steiner and Jason Heppler at the Center for Spatial and Textual Analysis, Stanford University. See their description of the data for a fuller accounting of how the data was gathered.

Examples

Run this code
# NOT RUN {
if (require(USAboundariesData)) {
  us_cities(1805)
  us_cities("1828-05-08")
  us_cities()
}

# }

Run the code above in your browser using DataLab