Skip to content

Instantly share code, notes, and snippets.

@mages
Last active August 29, 2015 13:55
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 mages/8751134 to your computer and use it in GitHub Desktop.
Save mages/8751134 to your computer and use it in GitHub Desktop.
# http://www.theguardian.com/news/reality-check/2014/jan/31/sex-guardian-readers-confess-all
# Source: https://docs.google.com/spreadsheet/ccc?key=0At6CC4x_yBnMdDduelJocVo5RDZzalltd0dSQzdXUmc&usp=sharing#gid=0
dat <- data.frame(AgeGroup=factor(
1:9,
labels= c("Younger than 16", "16-24",
"25-34", "35-44", "45-54",
"55-64", "65-74",
"Older than 74", "(blank)"),
ordered=TRUE),
No=c(34, 2079, 2585, 1593,
1274, 802, 291, 78, 13),
Yes=c(18, 1970, 4035, 2328,
1707, 924, 386, 68, 4))
library(latticeExtra)
asTheEconomist(
barchart(Yes + No ~ AgeGroup, dat,
auto.key=list(columns=2, space="top"),
main="Did you have sex in the last 4 weeks?\n"),
xlab="Age group",
ylab="Number of responses from Guardian data blog readers"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment