Below is the commented code for my project.
#Reading in the data
read.csv(“data.csv”)
data <- read.csv(“data.csv”)
#Creating a new column which reads TRUE when the college was founded before enslavement was made illegal
#and FALSE when the college was founded after enslavement was made illegal
#Creating a column for years schools were founded
a <- data$Year.of.founding
#Creating a column for slavery being outlawed in each state
b <- data$Year.slavery.was.outlawed.in.the.state
founded_while_slavery_was_legal <- a < b
#creating a new column in the dataframe
data$founded_while_slavery_was_legal <- founded_while_slavery_was_legal
#viewing the dataframe with the new column
data
#finding min and max in dataset in order to create x axis for visual
max(data$Year.of.founding)
min(data$Year.of.founding)
# Make ggplot code available to us
library(ggplot2)
#SYNTAX REMINDER
# create graph object
#g <- ggplot(name_of_dataframe, aes(name_of_one_column, name_of_the_other_column))
#create
g <- ggplot(data, aes(Year.of.founding, fill = founded_while_slavery_was_legal))
g + geom_histogram(binwidth = 5) + xlab(“number of schools”) + ylab(“year of institution founding”)