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(sf) | |
library(ggraph) | |
library(igraph) | |
# create some random data | |
country <- mapSpain::esp_get_prov(moveCAN=TRUE) | |
provinces <- st_cast(country,"MULTIPOLYGON") |> st_cast("POLYGON") | |
centroids <- distinct(provinces,iso2.prov.name.es,.keep_all = TRUE) |> | |
dplyr::filter(!iso2.prov.name.es%in%c("Baleares","Las Palmas","Santa Cruz de Tenerife","Ceuta","Melilla")) |> |
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
# original python code: https://fosstodon.org/@[email protected]/109376317839501128 | |
# mapping: https://twitter-elastic.pushshift.io/twitter_user/_mapping | |
library(curl) | |
library(jsonlite) | |
ngram_search <- function(q="",size = 10){ | |
data <- list(query=list()) | |
data[["query"]][["bool"]] <- list() | |
data[["query"]][["bool"]][["must"]] <- list() | |
match <- list() |
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(signnet) | |
library(igraph) | |
library(ggraph) | |
library(patchwork) | |
triads <- c("003-000000", "012-0000P0", "012-0000N0", | |
"102-0000PP", "102-0000NP", "102-0000NN", "021C-0PP000", | |
"021C-0NP000", "021C-0PN000", "021C-0NN000", "021U-0P0P00", | |
"021U-0N0P00", "021U-0N0N00", "021D-P0P000", "021D-N0P000", | |
"021D-N0N000", "111U-0P00PP", "111U-0N00PP", "111U-0P00NP", | |
"111U-0P00PN", "111U-0N00NP", "111U-0N00PN", "111U-0P00NN", |
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(ggplot2) | |
library(ggpubr) | |
library(ggtext) | |
df <- data.frame(x=seq.Date(as.Date("2020-04-01"),as.Date("2022-07-01"),by="month"),y=(1:28)^2) | |
p <- ggplot(df, aes(x, y))+ | |
geom_line(linewidth = 2.2,color="white",lineend = "round")+ | |
geom_line(linewidth = 1,color="red",lineend = "round")+ | |
scale_x_date(labels=scales::label_date("%b\n%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
--- | |
title: "Untitled" | |
format: html | |
--- | |
```{r} | |
#| label: prepare | |
#| echo: true |
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(dplyr) | |
library(data.table) | |
n <- 100 | |
df <- data.frame(id=LETTERS[1:10],meta=letters[1:10]) | |
other_dfs <- lapply(1:n,\(x) data.frame(id=LETTERS[1:10],values=rnorm(1:10))) | |
f <- function(n){ | |
for(i in 1:n){ |
OlderNewer