Skip to contents

Convert the GEOID of a 2016 US Census block to the name or GEOID for the corresponding state, county, tract or block group.

Usage

block_geoid_to(geoid, to, name = FALSE)

block_geoid_to_state(geoid, name = TRUE)

block_geoid_to_county(geoid, name = TRUE)

block_geoid_to_tract(geoid)

block_geoid_to_block_group(geoid)

Arguments

geoid

A character vector of 15-digit US Census block GEOIDs.

to

One of "state", "county", "tract", "block group" or (as an alias) "blockgroup".

name

Should the function return the state/county name rather than FIPS code?

Value

A character vector of GEOIDs or names.

Details

For details of the format of US Census GEOIDs, see https://www.census.gov/programs-surveys/geography/guidance/geo-identifiers.html.

Examples

block_geoid_to("360810443021005", to = "county", name = TRUE)
#> [1] "Queens County, NY"