Skip to content

Instantly share code, notes, and snippets.

@chryss
Last active January 1, 2016 04:29
Show Gist options
  • Save chryss/8091974 to your computer and use it in GitHub Desktop.
Save chryss/8091974 to your computer and use it in GitHub Desktop.
The puppy code
require(RCurl)
require(reshape2)
require(ggplot2)
puppies <- getURL("https://docs.google.com/spreadsheet/pub?key=0AtKrmILNPprEdEY4MFA5SWt5THRyYlB4cnhUNkxuOVE&single=true&gid=3&output=csv")
puppydat <- read.csv(textConnection(puppies), header=TRUE)
puppyflat <- melt(puppydat)
p <- ggplot(puppyflat, aes(X, value, color=factor(variable), group=variable))
p + geom_point(size=5) +
geom_line() +
aes(ymin=0) +
xlab("Date") +
ylab("weight (g)") +
#opts(legend.position = "none") +
stat_smooth(aes(group = 1)) +
stat_summary(aes(group = 1), geom = "point", fun.y = mean, shape = 18, size = 4) +
ggtitle("Puppy weights in gram (color) and average (black)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment