View clemency_analysis.R
rm(list=ls())
library(ggplot2)
library(rvest)
library(zoo)
url <- "https://www.justice.gov/pardon/obama-commutations"
clemency_info <-
url %>%
read_html() %>%
html_nodes(xpath = "/html/body/div[1]/div[2]/div/div/div[2]/article/div[1]/div/div/div/table[1]") %>%
View plotly_add_line.R
p <- layout(p, list(type = "line",
fillcolor = "blue", line = list(color = "blue"),
opacity = 0.3, x0 = "1997-02-11", x1 = "1997-02-11",
xref = "x", y0 = 0, y1 = 10.22, yref = "y"))
View plotly_line_list_creation.R
line_list <- list()
for(i in 1:nrow(line_dat)){
line_color <- ifelse(line_dat$signal[i] == 'buy', 'green', 'red')
line_list[[i]] <- list(type = "line",
fillcolor = line_color, line = list(color = line_color), opacity = 0.3,
x0 = line_dat[[1]][i], x1 = line_dat[[1]][i], xref = "x",
y0 = 0, y1 = line_dat[[2]][i], yref = "y")
}