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(systemfonts) | |
| ## data | |
| ## via https://projects.oregonlive.com/weather/temps/ | |
| df <- | |
| readr::read_csv("https://projects.oregonlive.com/weather/pdx_temps.csv") %>% | |
| mutate(yday = lubridate::yday(date), | |
| year = lubridate::year(date), | |
| decade = year %/% 10 * 10, |
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
| set.seed(2021) | |
| data <- tibble( | |
| group = factor(c(rep("Group 1", 100), rep("Group 2", 250), rep("Group 3", 25))), | |
| value = c( | |
| ## Group 1 | |
| seq(0, 20, length.out = 100), | |
| ## Group 2 | |
| c(rep(0, 5), rnorm(30, 2, .1), rnorm(90, 5.4, .1), rnorm(90, 14.6, .1), rnorm(30, 18, .1), rep(20, 5)), | |
| ## Group 3 |
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
| #' Download data to draw Berlin template map | |
| #' @examples download_data_berlin() | |
| download_data_berlin <- function() { | |
| ## SETUP --------------------------------------------------------------------- | |
| ## output dir for raw geo files | |
| dir <- here::here("data-raw", "geo-raw") | |
| if (!dir.exists(dir)) dir.create(dir, showWarnings = TRUE, recursive = TRUE) | |
| ## DISTRICTS ----------------------------------------------------------------- |
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(igraph) | |
| library(ggraph) | |
| df <- readRDS("data.Rds") | |
| graph <- graph_from_data_frame(df) | |
| sorting <- c(25, 24, 1, 2, 3, 4, 5, 6, 7, 8, 26, 27, c(9:23)) |
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) | |
| library(systemfonts) | |
| df_mac_raw <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-12-22/big-mac.csv') | |
| df_mac <- | |
| df_mac_raw %>% | |
| mutate(year = lubridate::year(date)) %>% | |
| dplyr::select(date, year, iso_a3, currency_code, name, local_price, |
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
| #### 1. Sign up at GitHub.com ################################################ | |
| ## If you do not have a GitHub account, sign up here: | |
| ## https://github.com/join | |
| # ---------------------------------------------------------------------------- | |
| #### 2. Install git ########################################################## | |
| ## If you do not have git installed, please do so: |
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(shiny) | |
| library(tmap) | |
| library(tidyverse) | |
| library(fullPage) | |
| data(World) | |
| world_vars <- setdiff(names(World), c("iso_a3", "name", "sovereignt", "geometry")) | |
| ui <- pagePiling( | |
| sections.color = c('#ebebeb', '#f1f1f1'), |
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(shiny) | |
| library(tmap) | |
| data(World) | |
| world_vars <- setdiff(names(World), c("iso_a3", "name", "sovereignt", "geometry")) | |
| ui <- fluidPage( | |
| tmapOutput("map"), | |
| selectInput("var", "Variable", world_vars) |
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(patchwork) | |
| df <- tibble(x = 1, y = 1) | |
| g <- ggplot(df, aes(x, y)) + | |
| scale_x_continuous(expand = c(0, 0)) + | |
| scale_y_continuous(expand = c(0, 0)) + | |
| coord_cartesian(clip = "off") + | |
| theme_void() + |
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(lubridate) | |
| locations <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-06-23/locations.csv') | |
| movement <- locations %>% | |
| filter(study_site != "Hart Ranges") %>% | |
| mutate( | |
| season = fct_rev(season), # reverse seasons | |
| longitude = round(longitude, 2), # round long, lat to reduce number of points |