Function to simplify finding state and state code definitions. Used in readNWISdata
and readWQPdata
.
Examples
fullName <- stateCdLookup("wi", "fullName")
abbriev <- stateCdLookup("Wisconsin", "postal")
id <- stateCdLookup("WI", "id")
name <- stateCdLookup(55, "fullName")
index <- stateCdLookup("WI", "tableIndex")
stateCd[index, ]
#> STATE STATE_NAME STUSAB STATENS
#> 51 55 Wisconsin WI 01779806
stateCdLookup(c("West Virginia", "Wisconsin", 200, 55, "MN"))
#> [1] "WV" "WI" NA "WI" "MN"