[R] Comparing to create a new list
RobertDavis
rdavis7408 at gmail.com
Fri Jun 22 00:22:54 CEST 2012
So I got this to work and thought that I should post it, in case it might
help someone else:
library(maptools)
library(maps)
elem_school_district <- readShapePoly("E:/My Documents/Web
Usage/RTest/School_District_Shape_Files/Elementary School
Districts/unzipped/tl_2010_47_elsd10.shp", IDvar="NAME10",
proj4string=CRS("+pro=11 + ellps=clrk66"))
secondary_school_district <- readShapePoly("E:/My Documents/Web
Usage/RTest/School_District_Shape_Files/Secondary School
Districts/unzipped/tl_2010_47_scsd10.shp", IDvar="NAME10",
proj4string=CRS("+proj=ll + ellps=clrk66"))
unified_school_district <- readShapePoly("E:/My Documents/Web
Usage/RTest/School_District_Shape_Files/Unified_School_Districts/Unzipped/tl_2010_47_unsd10.shp",
IDvar="NAME10", proj4string=CRS("+proj=ll + ellps=clrk66"))
plot(elem_school_district, xlim=c(-90,-83), ylim=c(35,40) ,col="green")
plot(secondary_school_district,xlim=c(-90,-83), ylim=c(35,40) ,col="blue",
add=TRUE)
plot(unified_school_district,xlim=c(-90,-83), ylim=c(35,40)
,col="lightgreen", add=TRUE)
counter=1
not_a_customer<-c( "4700570","4700360","4700900","4701590", "4701080",
"4701500", "4702940" )
j = 1
for (i in length(unified_school_district)) {
for (j in length(not_a_customer)){
unified_school_district$customer<-ifelse(unified_school_district$GEOID10%in%not_a_customer,1,0)
color_white_districts<-unified_school_district[unified_school_district$customer==1,]
}
}
plot(color_white_districts, xlim=c(-90,-83), ylim=c(35,40) , col="white",
add=TRUE)
color_white_districts
--
View this message in context: http://r.789695.n4.nabble.com/Comparing-to-create-a-new-list-tp4633856p4634153.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list