get.state.info: Get information on U.S. State(s)

View source: R/get.state.info.R

get.state.infoR Documentation

Get information on U.S. State(s)

Description

Query information about States, from proxistat package data in data(lookup.states, package='proxistat')

Usage

get.state.info(query, fields = "all")

Arguments

query

vector of 1+ elements, which can be
state FIPS code(s) (as numbers or strings with numbers),
state name(s) (exactly matching formats here), or
2-letter state abbreviation(s) (case insensitive).

fields

vector of 1+ character string names of the fields available here: FIPS.ST, ST, statename, ftpname, REGION, is.usa.plus.pr, is.usa, is.state, is.contiguous.us, is.island.areas, and others (see below)

Details

See proxistat package for data source (http://ejanalysis.github.io/proxistat/) For 1+ or all US States plus DC, PR, Island Areas (and USA overall for use in FTP URL):

EPA Region, FIPS, State name, abbreviation for State(s); based on any of these query methods:

State's FIPS, State's name, OR State's abbreviation, (i.e., FIPS.ST, statename, or ST).

Also see data in packages acs and choroplethr

Also see http://www.census.gov/geo/reference/docs/state.txt and http://www.census.gov/geo/reference/ansi.html
# Note on definitions of is.usa, is.contiguous.us, etc.:
https://www.census.gov/geo/reference/gtc/gtc_usa.html
https://www.census.gov/geo/reference/gtc/gtc_codes.html
https://www.census.gov/geo/reference/gtc/gtc_island.html
http://en.wikipedia.org/wiki/Contiguous_United_States

Also note this other possible list of abbreviations (not used) lacks US, PR, DC:
require(datasets); state.abb

Note another possible list of States, abbrev, FIPS
which has island areas but not US total and not leading zeroes on FIPS:
require(acs)
print(fips.state)

Note FIPS were also available here:
State: http://www.census.gov/geo/reference/ansi_statetables.html
County: http://www.census.gov/geo/www/codes/county/download.html

Also see https://www.census.gov/geo/reference/state-area.html for info on state area and internal point

Value

A data.frame (if query has 2+ elements), providing all or specified fields of information, covering matching states/dc/pr/island areas, a vector of the same type of information for just one place (if only 1 query term, i.e., one element in the query vector is provided), or NA if certain problems arise.

If no query term, or fields not specified, then all information fields are returned:
get.state.info()1:2,

statename FIPS.ST ST ftpname REGION is.usa.plus.pr is.usa is.state is.contiguous.us
1 Alabama 01 AL Alabama 4 TRUE TRUE TRUE TRUE
2 Alaska 02 AK Alaska 10 TRUE TRUE TRUE FALSE

is.island.areas area.sqmi area.sqkm landarea.sqmi landarea.sqkm waterarea.sqmi waterarea.sqkm
1 FALSE 52420 135767 50645 131171 1775 4597
2 FALSE 665384 1723337 570641 1477953 94743 245383

inland.sqmi inland.sqkm coastal.sqmi coastal.sqkm greatlakes.sqmi greatlakes.sqkm
1 1058 2740 517 1340 0 0
2 19304 49997 26119 67647 0 0

territorial.sqmi territorial.sqkm lat lon
1 199 516 32.73963 -86.84346
2 49320 127739 63.34619 -152.83707

See Also

clean.fips()

Examples

# data(lookup.states, package='proxistat')
# x <- get.state.info(); str(x); cat('\n'); x[ 1:2, ]
# get.state.info(c('alaska','north carolina', 'montana', "hawaii"),
 fields=c('ST','statename','REGION'))
# get.state.info('DC'); get.state.info('U.S. Virgin Islands'); get.state.info(4)
# get.state.info(c('New york','alaska','North Carolina','MONTANA', 'typo'))
# get.state.info(c('ny','DC','AK','mt', 'PR'))
# get.state.info( c(36, 36, 'ny', '  ny', 'ny  ', 'California', 'DC','AK','mt', 'PR',
 '02', 2, 'North carolina') )
# get.state.info(1:80)

ejanalysis/ejanalysis documentation built on April 2, 2024, 10:12 a.m.