Skip to content

Instantly share code, notes, and snippets.

@ats
Created May 2, 2010 23:06
Show Gist options
  • Save ats/387537 to your computer and use it in GitHub Desktop.
Save ats/387537 to your computer and use it in GitHub Desktop.
Quick stab at tracking specific names in the baby names data
# 2010-05-02 baby name exploration
# data from http://github.com/hadley/data-baby-names/
bnames <- read.csv("~/data/data-baby-names/baby-names.csv") // path to data
library(ggplot2)
wantedNames <- c("Page", "Plant") // set a list of names to plot over time
gotNames <- subset(bnames, bnames$name %in% wantedNames)
p <- ggplot(gotNames, aes(x=year, y=percent*100))
p + geom_point() + aes(colour=factor(name))
# p + geom_point() + aes(colour=factor(name)) + facet_grid(~ name) # use facet to split into multiple plots per group
# p + geom_point() + aes(colour=factor(name)) + facet_grid(~ sex) # use facet to split into multiple plots per group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment