R/check.state.R

Defines functions check.state

Documented in check.state

check.state<-function(state,statefips){
check.state.aux<-function(state,statefips){
data("countyfips",envir = parent.frame())
assign("temp",countyfips)
assign("countyfips",temp)

state<-tolower(state)
if(!statefips & nchar(state)==2){
		state<-countyfips$statename[countyfips$acronym==tolower(state)][1]

}else if(statefips){
		state<-countyfips$statename[substr(countyfips$fips,1,2)==state][1]
	}else{
		}

if(state%in%unique(countyfips$statename)==FALSE & statefips==FALSE){
	return(NULL)
	}
state
}
out<-check.state.aux(state,statefips)
}

Try the UScensus2000 package in your browser

Any scripts or data that you put into this service are public.

UScensus2000 documentation built on May 2, 2019, 5:13 p.m.