Get the SUMLEVEL code (e.g. "040", "150") from a fipstype string (e.g. "state", "blockgroup")
Source:R/sumlevel.R
sumlevel_from_fipstype.RdSUMLEVEL strings extracted from a Census GEO_ID are always 3 characters (e.g. "020", "040", "150"), so this function returns 3-character strings to match that width.
Details
Supported types (case-insensitive): state, county, city, tract, blockgroup, REGION, American Indian Area/Alaska Native Area/Hawaiian Home Land, MSA, CSA, Urban Area, Congressional District, ZCTA. The "block" type has no Census SUMLEVEL and returns NA.
See also
Census reference: https://www.census.gov/programs-surveys/acs/geography-acs/reference-materials.2023.html (ACS_2023_5-Year_Geocount file).