state_fips_lookup: state_fips_lookup

Description Usage Arguments Value Examples

View source: R/state_fips_lookup.R

Description

A helper function to find FIPS codes and buffers using state name. The function can also works in reverse to find state names and FIPS buffers using the state FIPS code.

Usage

1
state_fips_lookup(state_string, fips = NULL)

Arguments

state_string

a string with the name of the state to search. This should be the full name of the state to avoid ambiguous results.

fips

(Optional) a 2-digit FIPS code to search

Value

A tibble with the state FIPS code, the FIPS codes for the states sharing a boundary, and the name of the state.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# look up the data for Maryland
state_fips_lookup(state_string = "Maryland")

# the lookup is case insensitive 
state_fips_lookup(state_string = "maryland")
state_fips_lookup(state_string = "new york")

# the function will execute partial matches, but multiple results are possible.
# Multiple results are not necessarily useful
state_fips_lookup(state_string = "carolina")

# better to use full names
state_fips_lookup(state_string = "North Carolina")

# look up by FIPS code as string
state_fips_lookup(fips = "02")

# the function will search single number FIPS
state_fips_lookup(fips = 1)

usgs-bis/bad-neighbor-invasives documentation built on Sept. 26, 2019, 7:34 a.m.