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
options(stringsAsFactors = FALSE) | |
library(tidyverse) | |
library(sf) | |
library(rvest) | |
'https://thefactfile.org/u-s-states-and-their-border-states/' %>% | |
read_html %>% | |
html_table %>% | |
.[[1]] %>% | |
setNames(c("state_number", "REGISTEREDNAME", "state_border", "num_border")) %>% |
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 LIBRARIES | |
library(dplyr) | |
library(tidyr) | |
library(httr) | |
library(readxl) | |
## CUSTOM FUNCTION TO READ ALL SHEETS OF AN EXCEL FILE INTO A LIST OF DATA FRAMES OR TIBBLES THANKS STACK OVERFLOW!! | |
## https://stackoverflow.com/questions/12945687/read-all-worksheets-in-an-excel-workbook-into-an-r-list-with-data-frames | |
read_excel_allsheets <- function(filename, tibble = FALSE) { | |
sheets <- excel_sheets(filename) |
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
--- | |
title: "" | |
output: | |
flexdashboard::flex_dashboard: | |
orientation: rows | |
runtime: shiny | |
--- | |
Open Data Platform | |
======================================================================= |
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
#LINK TO DATA SHEETS HERE: http://dchr.dc.gov/public-employee-salary-information | |
#USE TABULIZER | |
options(stringsAsFactors = FALSE) | |
options(scipen = 10) | |
library(devtools) | |
install_github("ropenscilabs/tabulizerjars") | |
install_github("ropenscilabs/tabulizer") | |
library(tabulizer) | |
library(rvest) | |
library(dplyr) |
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
begin <- Sys.time() | |
library(jsonlite) | |
library(dplyr) | |
options(stringsAsFactors = FALSE) | |
coach <- data.frame() | |
for(a in 1:2989){ | |
tmp <- jsonlite::fromJSON(paste0("https://sports.usatoday.com/ajaxservice/ncaa/salaries__coach__",a)) | |
if(is.null(nrow(tmp$rows))){ |
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(rvest) | |
library(dplyr) | |
library(tidyr) | |
nfl <- data.frame() | |
for(a in letters[!(letters %in% c('q','x','z'))]){ | |
tmp <- read_html( | |
paste0("http://www.espn.com/nfl/college/_/letter/",a) | |
) %>% | |
html_node("table") %>% |
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
options(stringsAsFactors=FALSE) | |
options(scipen=20) | |
options(digits=15) | |
pkg_test <- function(x){ | |
if(x %in% rownames(installed.packages())){ | |
suppressWarnings(library(x,character.only=TRUE)) | |
return(paste0("Loaded the ",x," Package")) | |
} else { | |
install.packages(x) | |
suppressWarnings(library(x,character.only=TRUE)) |
NewerOlder