# Colors via http://clrs.cc/
clrs <- list(
navy = "#001F3F",
blue = "#0074D9",
aqua = "#7FDBFF",
teal = "#39CCCC",
olive = "#3D9970",
green = "#2ECC40",
lime = "#01FF70",
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(tidyverse) | |
| library(osmdata) | |
| library(sf) | |
| library(ggtext) | |
| library(exactextractr) | |
| library(fasterize) | |
| library(ggtext) | |
| library(tidygeocoder) | |
| library(glue) |
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://archive.org/details/ost-geography-completegeograph00sauluoft/page/n574/mode/1up | |
| # Inspired by @PaoloCrosetto's question and @geokaramanis's implementation | |
| # https://twitter.com/PaoloCrosetto/status/1448594997251657731 | |
| # https://twitter.com/geokaramanis/status/1447913599712825349 | |
| library(tidyverse) | |
| countries <- c("Belgium", "England", "Japan", "Italy", "China", "Germany", "France", "India", "Spain", "Phil. Is'ds", "Russia", "Cuba", "U. States", "Mexico", "Hawaii", "C.Colony", "Brazil", "Argentina", "Canada", "Australia") | |
| densities <- c(563,500,284,280,270,250,186,184,89,72,54,36,20,16,16,5,4.5,3,2,1.23) | |
| df <- tibble(country=factor(countries, levels=countries), # Trick to keep the order |
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) | |
| scooby_data <- read.csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-07-13/scoobydoo.csv") | |
| x <- | |
| scooby_data %>% | |
| select(season, title, | |
| starts_with("caught"), | |
| starts_with("captured"), | |
| starts_with("unmask"), |
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(tidycensus) | |
| library(ggiraph) | |
| library(tidyverse) | |
| library(patchwork) | |
| vt_income <- get_acs( | |
| geography = "county", | |
| variables = "B19013_001", | |
| state = "VT", | |
| year = 2019, |
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(tibble) | |
| df <- tribble( | |
| ~x, ~y, ~label, | |
| 1, 2, "A super long label oh god how am I going to deal with this", | |
| 2, 1, "A shorter one" | |
| ) | |
| # Default - text is cut off |
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) | |
| # https://github.com/jvangeld/ME-GIS | |
| coastline <- read_sf("ME-GIS-master/Coastline2.shp") | |
| contours <- read_sf("ME-GIS-master/Contours_18.shp") | |
| rivers <- read_sf("ME-GIS-master/Rivers.shp") | |
| lakes <- read_sf("ME-GIS-master/Lakes.shp") | |
| forests <- read_sf("ME-GIS-master/Forests.shp") | |
| mountains <- read_sf("ME-GIS-master/Mountains_Anno.shp") |
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(tidytext) | |
| library(gutenbergr) | |
| library(cleanNLP) | |
| little_women_raw <- gutenberg_download(514, meta_fields = "title") | |
| little_women <- little_women_raw %>% | |
| slice(70:n()) %>% | |
| mutate(chapter_start = str_detect(text, "^CHAPTER"), |
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
| ## Get current Apple COVID data | |
| ## Kieran Healy / @kjhealy | |
| ## E.g. apple_covid <- get_apple_data() | |
| ## 1. Find today's URL | |
| ## Thanks to David Cabo (@dcabo) for alerting me to the existence of the json file. | |
| get_apple_target <- function(cdn_url = "https://covid19-static.cdn-apple.com", | |
| json_file = "covid19-mobility-data/current/v3/index.json") { | |
| tf <- tempfile(fileext = ".json") |
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
| ## Infrastructure notes ######################################################## | |
| # I am running this in docker image rocker/tidyverse:3.6.1 | |
| # Load packages | |
| library(tidyverse) | |
| library(EpiEstim) | |
| ## Fetch data from the covid19data API ######################################### | |
| url <- "https://api.covid19data.dk/ssi_newly_hospitalized" |
NewerOlder