This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#load data from csv | |
grad_unemployment_data <- read.delim("https://raw.githubusercontent.com/sjstebbins/ExploratoryDataViz/master/data/graduateunemployment.csv") | |
#convert date | |
grad_unemployment_data$Date = as.Date(grad_unemployment_data$Date) | |
#filter for after 2003 | |
grad_unemployment_data <- filter(grad_unemployment_data, Date >= "2003-01-01") | |
#melt to single column | |
grad_unemployment_data <- melt(grad_unemployment_data, id = 'Date',measure.vars = names(select(grad_unemployment_data,-Date))) | |
#plot | |
ggplot(grad_unemployment_data, aes(x=Date,y=value, group=variable, color=variable)) + geom_line() + ggtitle('Graduate Unemployment & Underemployment') + theme_fivethirtyeight() + theme(legend.title=element_blank()) + theme(axis.title = element_text(), axis.title.x = element_blank()) + ylab('Percent') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#load data | |
student_loans_outstanding_df <- read.csv("https://fred.stlouisfed.org/data/SLOAS.csv") | |
#change column name | |
student_loans_outstanding_df <- transmute(student_loans_outstanding_df, Date=DATE, student_loans_outstanding=VALUE) | |
#convert to dollars | |
student_loans_outstanding_df$student_loans_outstanding = student_loans_outstanding_df$student_loans_outstanding * 100000 | |
#convert to Date | |
student_loans_outstanding_df$Date = as.Date(student_loans_outstanding_df$Date) | |
#plot | |
ggplot(student_loans_outstanding_df, aes(x=Date,y=student_loans_outstanding)) +geom_line( color='red') + ggtitle("Outstanding Student Loan Debt") + scale_x_date( labels = date_format("%Y")) + scale_y_continuous( labels = comma) + theme_fivethirtyeight() + theme(legend.title=element_blank()) + theme(axis.title = element_text(), axis.title.x = element_blank()) + ylab('Dollars') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#manually input data, student loan asset, and total federal asset data | |
student_loan_asset <- c(84.5,92.1,97.7,101.0,108.0,124.4,157.8,231.3,356.1,495.5,613.9,731.2,845.1) | |
total_federal_asset <- c(1405.4,1397.3,1447.9,1496.5,1581.1,1974.7,2667.9,2883.8,2707.3,2748.3,2968.3,3065.3,3229.8) | |
date <- c('2003','2004','2005','2006','2007','2008','2009','2010','2011','2012','2013','2014','2015') | |
#create dataframe | |
student_loan_federal_asset_data <- data.frame(Date=date,student_loan_asset=student_loan_asset, total_federal_asset=total_federal_asset) | |
#create percent column | |
student_loan_federal_asset_data$Percent= student_loan_asset/total_federal_asset | |
#remove other columns | |
student_loan_as_percentage_federal_assets <- select(student_loan_federal_asset_data, Percent, Date) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#load data | |
earnings_data <- read.delim("https://raw.githubusercontent.com/sjstebbins/ExploratoryDataViz/master/data/earnings.csv") | |
#convert date | |
earnings_data$Date = as.Date(earnings_data$Date) | |
#filter data for after 2003 | |
earnings_data <- filter(earnings_data, Date >= "2003-01-01") | |
#rename columns | |
earnings_data <- rename(earnings_data, college_grads=All, high_school_grads=All.1) | |
#melt data to single column | |
earnings_data <- melt(earnings_data, id = 'Date',measure.vars = names(select(earnings_data, -Men,-Women,-Men.1,-Women.1,-Date))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#load data | |
default_rate_data <- read.csv("https://raw.githubusercontent.com/sjstebbins/ExploratoryDataViz/master/data/default.csv", stringsAsFactors = FALSE) | |
#melt to single column | |
default_rate_data <- melt(default_rate_data, id = 'Date',measure.vars = names(select(default_rate_data,-Date))) | |
#plot | |
ggplot(default_rate_data, aes(x=Date,y=value, group=variable, color=variable)) + geom_line() + ggtitle('Student Loan Default Rates') + theme_fivethirtyeight() + theme(legend.title=element_blank()) + theme(axis.title = element_text(), axis.title.x = element_blank()) + ylab('Percent') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#select data from main data frame | |
increasing_college_costs <- select(data,Date,Total.cost.of.attendance..on.campus.) | |
#melt to single column | |
increasing_college_costs <- melt(increasing_college_costs,id = 'Date', value.name='Amount.in.Thousands') | |
#plot | |
ggplot(increasing_college_costs, aes(x=Date,y=Amount.in.Thousands,group=variable,color=variable)) + geom_line() + ggtitle('Average College Costs') + theme_fivethirtyeight() + theme(legend.title=element_blank()) + theme(axis.title = element_text(), axis.title.x = element_blank()) + ylab('Dollars')+theme(legend.position="none") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#select data from main dataframe | |
percent_federal_debt <- select(data,Date, Federal.debt.of.graduates..as.percent.of.total.debt) | |
#melt to single column | |
percent_federal_debt <- melt(percent_federal_debt ,id = 'Date', value.name='Percent') | |
#plot | |
ggplot(percent_federal_debt , aes(x=Date,y=Percent,group=variable,color=variable)) + geom_line() + ggtitle('Federal Borrowing as Percent of Total Debt') + theme_fivethirtyeight() + theme(legend.title=element_blank()) + theme(axis.title = element_text(), axis.title.x = element_blank()) + ylab('Percent')+ theme(legend.position="none") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
state_college_data <- read.csv("https://raw.githubusercontent.com/sjstebbins/ExploratoryDataViz/master/data/CollegeInSight_Explore.csv", stringsAsFactors = FALSE) | |
#parse state names | |
state_college_data$Name = gsub(' - 4-year or above', '', state_college_data$Name) | |
#rename Year column to Date and Name to State | |
state_college_data <- rename(state_college_data, Date=Year, State=Name) | |
#convert date to yearformat | |
state_college_data$Date = substr(state_college_data$Date,0, nchar(state_college_data$Date) -3) | |
#convert all NA in order to summarize on year | |
NAs <- state_data == "N/A" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dashboardBody( | |
#custom css styling | |
tags$head( | |
tags$style( | |
HTML(' | |
.main-sidebar { | |
padding-top: 0px !important | |
} | |
') | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
values <- reactiveValues(theme = system.file("images/world.jpg", package="threejs"), | |
lat = 0, long = 0, data = NULL, nodest= NULL) | |
#main slider filter | |
observeEvent(input$slider, { | |
#filter out NA destinations | |
data <- ihs[!is.na(ihs$Destination.Country.Lat) & !is.na(ihs$Source.Country.Lat),] | |
#filter out all routes where destination is same as source | |
data <- data[data$Source..1. != data$Primary.Destination.Country,] | |
#filter data based on date slider | |
values$data <- data[data$Date >= input$slider[1] & data$Date <= input$slider[2],] |
OlderNewer