is_valid_state: Returns TRUE if the given state is a valid state spelling

View source: R/is_valid_state.R

is_valid_stateR Documentation

Returns TRUE if the given state is a valid state spelling

Description

Returns TRUE if the given state is a valid state spelling given our state spelling naming conventions. Under our conventions, spellings include the 50 states spelled out (e.g. "Alabama"), "District of Columbia", the five populated U.S. territories, and "Not Available" (e.g. for federal facilities without a known state designation). Includes a parameter to return FALSE vs. NA if the given state spelling is NA.

Usage

is_valid_state(state, missing_as_na = T)

Arguments

state

character string of the state to check

missing_as_na

logical, whether NA should return NA (vs. FALSE)

Value

logical, TRUE if the given state is a valid state spelling

Examples

is_valid_state("DC")
is_valid_state(c("DC", NA, "District of Columbia"))

uclalawcovid19behindbars/behindbarstools documentation built on April 22, 2022, 4:08 a.m.