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
| ################################################################################ | |
| # replication of https://i.redd.it/q0udc4wfhvjz.gif | |
| # originally posted to r/dataisbeautiful by u/Tjukanov | |
| ################################################################################ | |
| library(tidyverse) | |
| library(gganimate) | |
| library(lubridate) | |
| #data from: https://www.ncdc.noaa.gov/ibtracs/index.php?name=wmo-data | |
| df <- read_csv("Allstorms.ibtracs_wmo.v03r09.csv") |
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
| Name | Biermarke | Long | Lat | |
|---|---|---|---|---|
| Augustiner-Keller | Augustiner | 11.551223 | 48.14374 | |
| Aujäger | Hacker Pschorr | 11.44961 | 47.919287 | |
| Alte Villa | Kaltenberger | 11.098123 | 48.026349 | |
| Alter Wirt Krailling | Augustiner | 11.417515 | 48.098479 | |
| Alter Wirt Etterschlag | Paulaner | 11.200658 | 48.086221 | |
| Alter Wirt Moosach | Hofbräu | 11.51235 | 48.180948 | |
| Alter Wirt Ramersdorf | Augustiner | 11.614319 | 48.114996 | |
| Ayinger Ottobrunn | Ayinger | 11.6647398 | 48.0651976 | |
| Bergl | Hacker Pschorr | 11.567563 | 48.260538 |
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(tidyverse) | |
| leagues <- "http://www.footballsquads.co.uk/archive.htm" %>% | |
| read_html() %>% | |
| html_nodes("a") %>% | |
| html_attr("href") | |
| leagues_tbl <- as_tibble(str_split(leagues,"/",simplify = T)) %>% | |
| mutate(link=leagues) %>% |
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
| #install UMAP from https://github.com/lmcinnes/umap | |
| #install.packages("rPython") | |
| umap <- function(x,n_neighbors=10,n_components=2,min_dist=0.1,metric="euclidean"){ | |
| x <- as.matrix(x) | |
| colnames(x) <- NULL | |
| rPython::python.exec( c( "def umap(data,n,d,mdist,metric):", | |
| "\timport umap" , | |
| "\timport numpy", | |
| "\tembedding = umap.UMAP(n_neighbors=n,n_components=d,min_dist=mdist,metric=metric).fit_transform(data)", |
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(tidyverse) | |
| # helper functions | |
| get_theo_refs_cache <- function(url){ | |
| doc <- read_html(url) | |
| caps <- doc %>% html_nodes("caption") %>% html_text() | |
| skippy <- (any(caps=="Hypothesis" | caps=="Hypotheses"))+0 | |
| refs <- doc %>% | |
| html_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
| library(igraph) | |
| library(smglr) | |
| library(tidyverse) | |
| library(ggraph) | |
| g <- sample_islands(9,40,0.2,10) | |
| g <- simplify(g) | |
| V(g)$grp <- rep(1:9,each=40) | |
| el <- get.edgelist(g) | |
| E(g)$col <- case_when( | |
| V(g)$grp[el[,1]]==1 & V(g)$grp[el[,2]] == 1 ~ 1, |
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
| id | home | away | |
|---|---|---|---|
| 1 | 3-2-2-2-1 | 4-2-2-1-1 | |
| 1 | P. Cech | Vardy | |
| 1 | Holding | Okazaki | |
| 1 | Monreal | Albrighton | |
| 1 | Kolasinac | Mahrez | |
| 1 | Elneny | Ndidi | |
| 1 | G. Xhaka | M. James | |
| 1 | Bellerin | Fuchs | |
| 1 | Oxlade-Chamberlain | Maguire |
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(gganimate) | |
| ascii <- c(";", ":", "!", "?", ".", "'", "\"", "(", ")", "[", "]", "{", | |
| "}", "@", "*", "/", "\\", "&", "#", "%", "`", "^", "+", "<", | |
| "=", ">", "|", "~", "$", "0", "1", "1", "10", "2", "2", "3", | |
| "3", "4", "4", "5", "5", "6", "6", "7", "7", "8", "8", "9", "9", | |
| "a", "a", "A", "b", "b", "B", "c", "c", "C", "d", "d", "D", "e", | |
| "e", "E", "f", "f", "F", "g", "g", "G", "h", "h", "H", "i", "i", | |
| "I", "j", "j", "J", "k", "k", "K", "l", "l", "L", "m", "m", "M", | |
| "n", "n", "N", "o", "o", "O", "p", "p", "P", "q", "q", "Q", "r", |
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(tidyverse) | |
| library(gganimate) | |
| library(extrafont) | |
| loadfonts() | |
| get_season <- function(x){ | |
| url <- paste0("https://www.basketball-reference.com/leagues/NBA_",x,"_totals.html") | |
| url %>% | |
| read_html() %>% |
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
| pyramid <- function(ymax=5,mcol="#CD3333",xoffset=0){ | |
| f <- function(a,b,y){ | |
| (y-b)/a | |
| } | |
| a1 <- ymax/0.65 | |
| b1 <- 0 | |
| c1 <- -ymax/(1-0.65) | |
| d1 <- -c1 | |
| a2 <- -ymax/(1-0.65) |
OlderNewer