I am trying to plot addresses on a precinct map. My program uses the following libraries:
# load libraries
library(ggplot2)
library(maptools)
library(mapproj)
library(plyr)
library(sp)
library(rgdal)
library(rgeos)
library(ggmap)
The relevant code is below:
#Generating Map
#f.dist_1 contains longitude, latitude and a group id identifting precincts
distMap <- ggplot(data = f.dist_1, aes(x=longitude, y=latitude, group = id))
#Create map file and precinct outlines
distMap <- distMap + geom_polygon(fill="aliceblue")
distMap <- distMap + geom_path(color= "black",aes(group=group))
#f.canvassu2 contains household data, longitude ("lon") and latitude ("lat") value
#Plot selected households; this statement throws the error:
Don't know how to automatically pick scale for object of type function. Defaulting to continuous Error in data.frame(x = c(-105.0038579, -105.003855, -105.002154, -105.001437, : arguments imply differing number of rows: 48, 0
distMap <- distMap + geom_point(data=f.canvassu2,aes(x=lon, y=lat), size=2)
The "log" and "lat" variables in the f.canvassu2 data frame are numeric.
Does anyone know why the "Don't know how to automatically pick scale for object..." error occurs? How have others resolved this error?
f.dist_1
seems to be a SpatialPolygonDataFrame. If not, that is already covered to data.frame usingfortify
. I am just guessing here though. Please update your question. :) – jazzurrodput(head(f.canvassu2))
&dput(head(f.dist_1))
would really help – hrbrmstr