Description Usage Arguments Details Examples
TranslateStateCodes
particularly translates USGS state_cd to other formats.
Data from:
https://www.census.gov/geo/reference/ansi_statetables.html
and particularly
http://www2.census.gov/geo/docs/reference/state.txt
The returnVal choice determines the format returned. Choices are:
"STATE" is the FISP state code in the range of 1-78 (with some missing).
"STUSAB" is the common or postal 2 letter abreviation.
"STATE_NAME" is the full name.
"STATENS" is Geographic Names Information System Identifier (GNISID)
1 2 | TranslateStateCodes(inVector, returnVal = c("STATE", "STUSAB",
"STATE_NAME", "STATENS")[2])
|
inVector |
integer or character, a vector of one of the types of to convert. Not case sensitive for strings. |
returnVal |
Character string for the desired output format. Defaults to STUSAB and this choice overrides when the output type is the same as the input type. |
See internals of code to get the details of the data frame used for the translation.
1 2 3 4 5 6 7 | stNums <- c(1,15,25, 5, 50, NA)
ab <- tolower(TranslateStateCodes(stNums))
ab
names <- TranslateStateCodes(ab); names ## note default for abs in is names out
gnis <- TranslateStateCodes(tolower(names),'STATENS'); gnis
num <- TranslateStateCodes(gnis,'STATE'); num
all(num==stNums, na.rm=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.