0

Not sure anyone can help with this:

I've got a map of NYC showing crime by precinct area. The precincts are outlined, but since most people don't know precinct areas, I'd like the neighborhood names to appear on the map. Here is my current code:

    CrimeDataB01 <- CrimeData %>% filter(CRIME == "BURGLARY" & Year == "2001")
    CrimeDataB01 <- inner_join(MyShapeMapData, CrimeDataB01, by = 'Precinct')
    B01 <- ggplot(CrimeDataB01, aes(x = long, y = lat))
    B01 + geom_polygon(aes(group = group, fill = Occurrences)) + scale_fill_gradient(limits = c(0, 1100), low="darkgreen",high="red")

I'd like to layer this ggplot with the names of NYC neighborhoods. I've downloaded a centroid csv file for NYC neighborhoods, and the data isn't in lat/long coordinates. Instead, it has a column for "Geometry_X" and "Geometry_Y", with numbers like 1026494.605 and 265280.0919. How would I plot this over my currently created map? Thanks

SymbolixAU
  • 25,502
  • 4
  • 67
  • 139
DataScienceAmateur
  • 178
  • 2
  • 4
  • 12
  • Do the 2 datasets share any variables in common? If not, how would one know which neighborhood name should be plotted on which precinct? – jesstme Jan 29 '17 at 21:18
  • well the first dataset has lat long points and so does the second – DataScienceAmateur Jan 29 '17 at 22:31
  • If you know the coordinate system used, then the `rgdal` package maybe able to translate the Geometry_X and _Y into latitude and longitude. – Dave2e Jan 30 '17 at 02:58
  • If you provide a reproducible example, more of us will be able & willing to help. See: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – jesstme Feb 02 '17 at 18:02

0 Answers0