Skip to content

Instantly share code, notes, and snippets.

@drjwbaker
Last active August 29, 2015 14:25
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 drjwbaker/29b9b3a621890891a1dc to your computer and use it in GitHub Desktop.
Save drjwbaker/29b9b3a621890891a1dc to your computer and use it in GitHub Desktop.
(Figure 8) Code, control, and making the argument in the Humanities
#loadpackages
setwd("/home/james/Documents/2015-07_BM-R/derived_data")
library(lubridate)
library(dplyr, warn.conflicts = FALSE)
library(tidyr, warn.conflicts = FALSE)
library(ggplot2)
#read data from csv
names <- read.csv("BM.csv") %>%
group_by(DECADE, GENDER) %>%
mutate(mean_decade = mean(N)) %>%
select(mean_decade, DECADE)
#plot data
ggplot(names, aes(x = DECADE, y = mean_decade, group = GENDER, linetype = GENDER)) +
ggtitle("A Facet Grid (mean(N), by GENDER)") +
geom_point() +
geom_line() +
facet_grid(GENDER ~ .)
#save data to file
setwd("/home/james/Documents/2015-07_BM-R/viz")
ggsave("BBM_genderdecade-mean-grid.png", width = 7, height = 7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment