Skip to content

Instantly share code, notes, and snippets.

@gabrielflorit
Forked from finiterank/Gender Parity
Created May 31, 2014 04:22
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 gabrielflorit/e069c881ede569742029 to your computer and use it in GitHub Desktop.
Save gabrielflorit/e069c881ede569742029 to your computer and use it in GitHub Desktop.
library(plyr)
library(reshape2)
library(ggplot2)
edx <- read.csv("data//HMXPC13_DI_v2_5-14-14.csv")
gender.table <- ddply(edx, .(final_cc_cname_DI, gender), summarise, number = length(userid_DI))
levels(gender.table$gender) <- c("none", "female", "male", "other")
gender.table <- dcast(gender.table, final_cc_cname_DI ~ gender, value.var="number")
gender.table$parity <- gender.table$female / gender.table$male
ggplot(gender.table, aes(x=parity, y=reorder(final_cc_cname_DI,parity))) +
geom_point(size=5, shape=15, color="orangered") +
xlab(expression(frac(Males, Females))) +
ylab("Country")
@MarthaEugenia
Copy link

Should the expression on the x label be frac(Females, Males) instead?

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