title: Drawing choropleth map - 'Aesthetics error' in ggmap
body: <p>everyone!</p>
  
  <p>I am attempting to create a choropleth map of the Denver metro area, showing different housing values by census tract. When I try to map, it gives me <code>'Error: Aesthetics must be either length 1 or the same as the data (83658): x, y, group, fill'...</code>  How do I solve this problem, so I can create a visual map?</p>
  
  <p>I read through various questions but none appeared to help answer the problem. Suggestions will be appreciated. A sample of 20 (of 588) data points is below.</p>
  
  <p>Thanks!</p>
  
  <p>1.Load packages </p>
  
  <pre><code>library(maptools)
  library(ggmap)
  library(ggthemes)
  library(rgdal)
  </code></pre>
  
  <p>2.Select, define, plot initial map</p>
  
  <pre><code> DenverMetro &lt;- c(-105, 40, -104.8535, 39.3760)
      DenverMetroMap &lt;- get_map(location=DenverMetro, 
                                source = "google", 
                                maptype = "roadmap",
                                zoom = 10,
                                crop=FALSE)
      ggmap(DenverMetroMap)
  </code></pre>
  
  <p>3.Import polygons from shp file</p>
  
  <pre><code>DenverMetroCensusTracts &lt;-readOGR(dsn = "c://Users/John/Denver_Housing_Project/ACS_Data/Final_Data", layer = "cb_2013_08_tract_500k")
  proj4string(DenverMetroCensusTracts)
  DenverMetroCensusTracts &lt;-spTransform(DenverMetroCensusTracts,
                                CRS("+proj=longlat + datum=WGS84"))
  </code></pre>
  
  <p>4.Create initial census tract map</p>
  
  <pre><code>ggmap(DenverMetroMap) + geom_polygon(aes(x = long, y = lat, group=id),
               data = DenverMetroCensusTracts, 
               color="white", 
               fill="orange",
               alpha = .4, size = .2)
  </code></pre>
  
  <p>5a.Import Denver housing data, make one variable numeric, and merge with census shapefile </p>
  
  <pre><code>        setwd('C:/Users/John/Denver_Housing_Project/ACS_Data/Final_Data')
          Median_Values_ACS_13_DHP &lt;-read.csv('ACS_13_5YR_B25077_DHP.csv',
           na.strings=c("NA", "-", "?", "(X)"), header=TRUE)
          names(Median_Values_ACS_13_DHP) &lt;-c("AFFGEOID", "Id2", "Geography", "Year",
                                               "HouseValue_Median", "HouseValue_Median_MOE_DHP")
  
   HouseValue_Median=as.numeric(as.character(Median_Values_ACS_13_DHP$HouseValue_Median))
  
  Mapping  &lt;-merge(DenverMetroCensusTracts, Median_Values_ACS_13_DHP, by.x="AFFGEOID") 
  </code></pre>
  
  <p>6.Create choropleth map</p>
  
  <pre><code>ggmap(DenverMetroMap) + geom_polygon(aes(x = long, y = lat, group = id, 
   fill = HouseValue_Median), data = Mapping, alpha = .4, size = .2) +
   scale_fill_gradient()
  </code></pre>
  
  <p>GEO.id  GEO.id2 GEO.display-label   YEAR    HD01_VD01   HD02_VD01
  1400000US08001007801    8001007801  Census Tract 78.01, Adams County, Colorado  2013    150300  40311
  1400000US08001007802    8001007802  Census Tract 78.02, Adams County, Colorado  2013    114700  4570
  1400000US08001007900    8001007900  Census Tract 79, Adams County, Colorado 2013    118600  8228
  1400000US08001008000    8001008000  Census Tract 80, Adams County, Colorado 2013    139000  10440
  1400000US08001008100    8001008100  Census Tract 81, Adams County, Colorado 2013    29800   105549
  1400000US08001008200    8001008200  Census Tract 82, Adams County, Colorado 2013    145100  6189
  1400000US08001008308    8001008308  Census Tract 83.08, Adams County, Colorado  2013    46300   67342
  1400000US08001988700    8001988700  Census Tract 9887, Adams County, Colorado   2013    -   **
  1400000US08001008309    8001008309  Census Tract 83.09, Adams County, Colorado  2013    36600   18824
  1400000US08001008353    8001008353  Census Tract 83.53, Adams County, Colorado  2013    134600  8921
  1400000US08001008401    8001008401  Census Tract 84.01, Adams County, Colorado  2013    241300  43038
  1400000US08001008402    8001008402  Census Tract 84.02, Adams County, Colorado  2013    215900  15189
  1400000US08001008505    8001008505  Census Tract 85.05, Adams County, Colorado  2013    174100  6525
  1400000US08001008506    8001008506  Census Tract 85.06, Adams County, Colorado  2013    157300  15556
  1400000US08001008507    8001008507  Census Tract 85.07, Adams County, Colorado  2013    177800  5644
  1400000US08001008508    8001008508  Census Tract 85.08, Adams County, Colorado  2013    188700  10424
  1400000US08001008523    8001008523  Census Tract 85.23, Adams County, Colorado  2013    268500  29657
  1400000US08001008524    8001008524  Census Tract 85.24, Adams County, Colorado  2013    231200  4994
  1400000US08001008526    8001008526  Census Tract 85.26, Adams County, Colorado  2013    284900  14945</p>