Guest User

Untitled

a guest
Jul 21st, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. library(ggplot2)
  2. library(dplyr)
  3. library(lubridate)
  4. library(scales)
  5. library(grid)
  6. library(RColorBrewer)
  7. library(extrafont)
  8. library(reshape)
  9. library(ggthemes)
  10.  
  11. by_borough = dplyr::filter(Rat_Sightings_utf, Borough != "Unspecified")
  12.  
  13.  
  14. by_borough$Created.Date <-strptime(as.character(by_borough$Created.Date), "%m/%d/%Y")
  15. format(by_borough$Created.Date, "%Y-%m-%d")
  16.  
  17. by_borough$year <- as.Date(cut(by_borough$Created.Date, breaks="year"))
  18.  
  19. by_anio = subset(by_borough, format(as.Date(Created.Date),"%Y") != 2018)
  20.  
  21. ## Create Visualization
  22. ggplot(by_anio, aes(year, ..count..)) +
  23. geom_bar(position = "stack", alpha=.90, fill="#009E73", size=2)+facet_grid(Borough~.) +
  24. labs(title="Rat Sightings By Borough (2010 - 2017)", x= "", y=" ") + theme_minimal()
Add Comment
Please, Sign In to add comment