data(murders)
date1 <- as.Date(murders$date,"%m/%d/%y")
date2 <- julian(date1,origin = as.Date("2006-01-02"))
date_cut <- cut(date2, seq(0, 2073, 90))
barplot(table(date_cut), xaxt = "n",
xlab = "date from 01/2006 - 09/2011",
ylab = "n deaths per 90 days")
## Not run:
# # install.packages("ggplot2")
# # install.packages("RColorBrewer")
# library(ggplot2)
# library(RColorBrewer)
# data(london_boroughs)
# LB <- london_boroughs
# mtab <- table(murders$borough)
# LB$nmurders <- rep(mtab, rle(as.character(LB$name))$lengths)
# p <- ggplot()
# p +
# geom_polygon(data=LB, aes(x=x, y=y, group = name, fill = nmurders),
# colour="white" ) +
# scale_fill_gradientn(colours = brewer.pal(7, "Blues"),
# limits=range(LB$nmurders))
# ## End(Not run)
Run the code above in your browser using DataLab