I want to make multiple plots (in r) of the occurrence of crime in a certain city. The city has 42 zip codes, and I want to make a plot for each of the zip codes (i.e. 42 plots in total). My data recorded seven different types of crime, and I want to identify each type of crime with a different color. So for each plot (representing a zip code) I would have different colors for different crime. I want to plot the data on a satellite map from google earth. I wrote this code to do it:
Zip <- Sepfel$Zipcode
for(i in unique(Sepfel$Zipcode)){
map <- get_map(location='Lezmmas', zoom=11, maptype="satellite")
ggmap(map) + geom_point(subset(Sepfel,Sepfel$Zipcode==i), aes(color=Offense, x=Longitude, y=Latitude),size=0.00001, alpha=1) + ggtitle(paste("September 2015"))
}
But the code doesn't run. Could someone help me to fix this?