This file contains 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
# Import the required modules | |
from selenium import webdriver | |
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
import time | |
import json | |
def get_perf_log_on_load(url, headless = True, filter = None): | |
# Main Function | |
# Enable Performance Logging of Chrome. |
This file contains 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(rvest) | |
library(ggpubr) | |
library(COVID19) | |
## 1st step: | |
# go to http://www.sharkattackdata.com/place/united_states_of_america | |
## 2nd step: | |
# save HTML file to same location as script |
This file contains 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) | |
## this r code is taking from here: https://github.com/mkearney/pkguse | |
read_r_files <- function(...) { | |
dirs <- unlist(list(...)) | |
r <- unlist(lapply(dirs, list.files, | |
pattern = "\\.(R|Rmd|Rmarkdown|rmd|r|Rhistory)$", | |
recursive = TRUE, | |
full.names = TRUE, | |
all.files = TRUE)) |
This file contains 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
#=============================================================================== | |
# 2022-07-12 | |
# Extract data from Latent GOLD within R | |
# Fabio Votta (@favstats) | |
#=============================================================================== | |
library(tidyverse) | |
library(data.table) | |
setwd(here::here()) |
This file contains 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
#=============================================================================== | |
# 2022-07-10 | |
# Year progress twitter | |
# Fabio Votta (@favstats) | |
# Idea blatantly stolen from Ilya Kashnitsky (@ikashnitsky) | |
#=============================================================================== | |
library(tidyverse) | |
library(magrittr) | |
library(lubridate) |
This file contains 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
save_csv <- function(d, path) { | |
if(file.exists(path)){ | |
readr::write_csv(d, append = T, file = path) | |
} else { | |
dirs_to_create <- stringr::str_split(path, "\\/") %>% | |
unlist() %>% | |
purrr::discard(~stringr::str_detect(.x, "\\.")) %>% | |
paste0(collapse = "/") |
This file contains 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(httr) | |
token <- Sys.getenv("fb_marketing_token") | |
#link to fb api | |
my_lin k<- "https://graph.facebook.com" | |
#define fields you are interested in | |
search_fields=c("ad_creation_time", |
This file contains 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(modelbased) | |
library(magrittr) | |
overview <- readRDS("data/overview.rds") | |
## helper function | |
get_plabs <- function (pval) { | |
dplyr::case_when(is.na(pval) ~ "", pval < 0.001 ~ "***", | |
pval < 0.01 ~ "**", pval < 0.05 ~ "*", |
This file contains 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
## Create NYT Spiral Animations | |
## Most Code comes from here: https://bydata.github.io/nyt-corona-spiral-chart/ | |
library(tidyverse) | |
library(lubridate) | |
library(gganimate) | |
library(viridis) | |
owid_url <- "https://github.com/owid/covid-19-data/blob/master/public/data/owid-covid-data.csv?raw=true" |
This file contains 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
### Code mostly inspired by https://github.com/HudsonJamie/tidy_tuesday/blob/main/2021/week_46/afrilearndata.R | |
library(pdftools) | |
library(tidygeocoder) | |
library(tidyverse) | |
library(janitor) | |
library(rgdal) | |
library(osmdata) | |
library(sf) | |
library(ggfx) |
NewerOlder