Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(Figure 6) 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) %>%
mutate(mean_decade = mean(N)) %>%
select(mean_decade, DECADE)
#plot data
ggplot(names, aes(x = DECADE, y = mean_decade)) +
ggtitle("A Line Graph (mean(N), by DECADE)") +
geom_point() +
geom_line()
#save data to file
setwd("/home/james/Documents/2015-07_BM-R/viz")
ggsave("BM_decade-mean.png", width = 7, height = 7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment