stateCdLookup: State code look up

Description Usage Arguments Examples

View source: R/readNWISdata.r

Description

Function to simplify finding state and state code definitions. Used in readNWISdata and readWQPdata.

Usage

1
stateCdLookup(input, outputType = "postal")

Arguments

input

could be character (full name, abbreviation, id), or numeric (id)

outputType

character can be "postal","fullName","tableIndex", or "id".

Examples

1
2
3
4
5
6
7
fullName <- stateCdLookup("wi", "fullName")
abbriev <- stateCdLookup("Wisconsin", "postal")
id <- stateCdLookup("WI", "id")
name <- stateCdLookup(55, "fullName")
index <- stateCdLookup("WI", "tableIndex")
stateCd[index,]
stateCdLookup(c("West Virginia", "Wisconsin", 55, "MN"))

Example output

   STATE STUSAB STATE_NAME  STATENS
50    55     WI  Wisconsin 01779806
[1] "WV" "WI" "WI" "MN"

dataRetrieval documentation built on Sept. 28, 2017, 5:04 p.m.