Skip to content

Instantly share code, notes, and snippets.

@luiscruz
Created February 10, 2016 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luiscruz/40c444c38ae6608a23fa to your computer and use it in GitHub Desktop.
Save luiscruz/40c444c38ae6608a23fa to your computer and use it in GitHub Desktop.
Use facet_wrap to compare a variable (friend_count) distribution according to the value of another variable (gender)
library(ggplot2)
pf <- read.delim("https://s3.amazonaws.com/udacity-hosted-downloads/ud651/pseudo_facebook.tsv")
qplot(data=subset(pf, !is.na(gender)), x=friend_count, binwidth=25)+
scale_x_continuous(limits = c(0,1000), breaks=seq(0,1000,50))+
facet_wrap(~gender)
@luiscruz
Copy link
Author

rplot01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment