I'm looking at the following example from Hadley Wickham's ggplot2
:
library(ggplot2)
library(maps)
states<-map_data("state")
arrests<-USArrests
names(arrests)<-tolower(names(arrests))
arrests$region<-tolower(rownames(USArrests))
chloro<-merge(states, arrests, by="region")
chloro<-chloro[order(chloro$order), ]
qplot(long, lat, data=chloro, group=group, fill = assault, geom="polygon")
I would then like to add points for some notable US cities to the map, but I haven't been able to. I've tried:
base_map<-qplot(long, lat, data=chloro, group=group, fill = assault, geom="polygon")
base_map + qplot(long, lat, data=us.cities) + borders("state", size=.5)
But I get the following error:
Error in p + o : non-numeric argument to binary operator
In addition: Warning message:
Incompatible methods ("+.ggplot", "Ops.data.frame") for "+""
How can I add these points?