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
library(shiny) | |
# taken from https://shiny.rstudio.com/tutorial/written-tutorial/lesson3/ | |
# Define UI ---- | |
ui <- fluidPage( | |
titlePanel("Basic widgets"), | |
fluidRow( | |
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
library(tidyverse) | |
library(lubridate) | |
x = read_csv("https://projects.fivethirtyeight.com/trump-approval-data/approval_topline.csv") | |
x %>% | |
select(subgroup, approve_estimate, disapprove_estimate, timestamp) %>% | |
mutate(spreadd = disapprove_estimate - approve_estimate) %>% | |
filter(subgroup != "All polls") %>% | |
mutate(date = parse_date_time(timestamp, orders = "H!:M!:S! d! b! Y!")) %>% |
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
# PCA on n=6990 images of handwritten 2's, each with d = 784 pixels. | |
# install.packages("remotes") | |
# remotes::install_github("jlmelville/snedata") | |
# thank you jlmelville for making this data so easy to access! | |
library(snedata) | |
library(magrittr) | |
library(Matrix) | |
library(rARPACK) |
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
library(rARPACK) | |
library(dplyr) | |
library(tidyr) | |
library(RColorBrewer) | |
library(BatchGetSymbols) | |
# 4 years of data | |
first.date <- Sys.Date()-365*4 | |
last.date <- Sys.Date() |