See also pictures.
We first determine the approximate partition by state. The state codes are from partition_by_state
> setwd("E:/Data/counties/9nations") > library(maptools) > gpclibPermit() > standard <- function(x) {s <- paste("0000",x,sep=""); substr(s,nchar(s)-4,nchar(s))} > USsta <- readShapeSpatial("USA/USA_adm1.shp") # state borders > UScou <- readShapeSpatial("USA/USA_adm2.shp") # county borders > load('pq.Rdata') > state <- read.csv("../pajek/states3110.clu",header=FALSE,skip=1)$V1 > col <- c("red","yellow","green","blue","pink","brown","orange","purple","grey","white","cyan") > ant <- rep(NA,3110) > ant[state %in% c(9,44)] <- 1 # New Netherland > ant[state %in% c(51,11,24,10,37)] <- 2 # Tidewater > ant[state %in% c(25,27,55,50,33,36,23,26)] <- 3 # Yankeedom > ant[state %in% c(20,34,19,42,39)] <- 4 # The Midlands > ant[state %in% c(5,28,1,13,12,45)] <- 5 # Deep South > ant[state %in% c(22)] <- 6 # New France > ant[state %in% c(29,21,18,17,54,48,47,40)] <- 7 # Greater Appalachia > ant[state %in% c(35,4)] <- 9 # El Norte > ant[state %in% c(38,32,46,31,30,49,16,8,53,6,41,56)] <- 10 # The Far West > clu <- rep(NA,length(UScou$NAME_1)) > for(v in 1:3110) {i <- q[[p[[v]]]]; if(!is.na(i)) clu[[i]] <- ant[[v]]} > pdf("UScAnt.pdf",width=11.7,height=8.3,paper="a4r") > plot(UScou,xlim=c(-124,-67),ylim=c(23,48),col=col[clu],bg="skyblue",border="black",lwd=0.05) > plot(USsta,xlim=c(-124,-67),ylim=c(23,48),lwd=0.2,border="violet",add=TRUE) > text(coordinates(UScou),labels=as.character(UScou$NAME_2),cex=0.1) > title("Central US"); dev.off() > ids <- read.csv("../usc3110lab.csv",header=FALSE,stringsAsFactors=FALSE) > id <- ids$V2 <- standard(ids$V2) > S <- read.csv(file="states.csv",stringsAsFactors=FALSE,sep=";") > states <- levels(UScou$NAME_1); ps <- match(states,S$name) > names <- paste(UScou$NAME_2,", ",S$code[ps[as.integer(UScou$NAME_1)]],sep="") > Name <- rep(NA,3110) > for(v in 1:3110) {i <- q[[p[[v]]]]; if(!is.na(i)) Name[[v]] <- names[[i]]} > cling <- data.frame(name=Name,cluster=ant) > write.csv(cling,file="../ANT/ANTcorr.csv",row.names=FALSE)
> col <- c("goldenrod","darkorange3","yellow","hotpink","green4","deepskyblue","blue", "sienna","red","green","orchid","royalblue") > col <- c("darkgoldenrod1","chartreuse","cadetblue3","darkolivegreen3","darkorange","darksalmon", "firebrick1","khaki3","lightgreen","orangered","orchid","peru") > library(RColorBrewer) > col<-brewer.pal(12,"Set3")
Thirty-nine of the USA's 42 independent cities are in Virginia. The three that are not in Virginia are Baltimore, Maryland; St. Louis, Missouri; and Carson City, Nevada.
> city <- c( "Alexandria, VA", "Bedford, VA", "Bristol, VA", "Buena Vista, VA", "Charlottesville, VA", "Chesapeake, VA", "Colonial Heights, VA", "Covington, VA", "Danville, VA", "Emporia, VA", "Fairfax, VA", "Falls Church, VA", "Franklin, VA", "Fredericksburg, VA", "Galax, VA", "Hampton, VA", "Harrisonburg, VA", "Hopewell, VA", "Lexington, VA", "Lynchburg, VA", "Manassas, VA", "Manassas Park, VA", "Martinsville, VA", "Newport News, VA", "Norfolk, VA", "Norton, VA", "Petersburg, VA", "Poquoson, VA", "Portsmouth, VA", "Radford, VA", "Richmond, VA", "Roanoke, VA", "Salem, VA", "Staunton, VA", "Suffolk, VA", "Virginia Beach, VA", "Waynesboro, VA", "Williamsburg, VA", "Winchester, VA", "Baltimore, MD", "St. Louis, MO", "Carson City, NV" )
http://en.wikipedia.org/wiki/U.S._state
Now we iterate:
> change <- read.csv(file="../ANT/ANTcorr.csv",stringsAsFactors=FALSE,sep=",",header=TRUE) > ant <- change$cluster > clu <- rep(NA,length(UScou$NAME_1)) > for(v in 1:3110) {i <- q[[p[[v]]]]; if(!is.na(i)) clu[[i]] <- ant[[v]]} > pdf("../ANT/UScAnt.pdf",width=11.7,height=8.3,paper="a4r") > plot(UScou,xlim=c(-124,-67),ylim=c(23,48),col=col[clu],bg="white",border="black",lwd=0.05) > plot(USsta,xlim=c(-124,-67),ylim=c(23,48),lwd=0.2,border="navy",add=TRUE) > text(coordinates(UScou),labels=as.character(UScou$NAME_2),cex=0.1) > title("Central US"); dev.off()
The final map is on uscant.pdf.
NOTE! There are some NAs in the partition. Check!