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
I am attesting that this GitHub handle thomasp85 is linked to the Tezos account tz2Pkj2xWJovKKCsABjnr3NbyMVJTMBkpTvb for tzprofiles | |
sig:spsig1Ehb3tCbCP8GEJnhztgv2fSLaSk2HYnNfuC5TczfrPC6DsXfqGNpiSPxj6PjyK3Z4hrQgbegczwP6GEek8HirA9FzoRGK9 |
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
--- | |
title: "ggplot2 examples and exercises" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
``` | |
This document contains all the code that is displayed during the workshop. The |
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
/* rs-theme-name: Idle Eyes */ | |
/* rs-theme-is-dark: TRUE */ | |
.ace_gutter { | |
background: #3b3b3b; | |
color: rgb(153,153,153) | |
} | |
.ace_print-margin { | |
width: 1px; | |
background: #555; | |
} |
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
transformers <- styler::tidyverse_style() | |
transformers$token$fix_quotes <- function (pd_flat) { | |
str_const <- pd_flat$token == 'STR_CONST' | |
str_const_change <- grepl('^"(.*)"$', pd_flat$text[str_const]) | |
raw_str <- sub('^"(.*)"$', '\\1', (pd_flat$text[str_const][str_const_change])) | |
raw_str <- gsub('(\\\\)?\'', '\\\\\'', raw_str) | |
raw_str <- gsub('\\\\"', '"', raw_str) | |
pd_flat$text[str_const][str_const_change] <- paste0('\'', raw_str, '\'') | |
pd_flat | |
} |
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
--- | |
title: "gganimate cookbook code" | |
output: | |
html_document: | |
df_print: tibble | |
highlight: kate | |
css: gganimate_cookbook.css | |
--- | |
```{r setup} |
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
--- | |
title: "PDF Animation Test" | |
output: pdf_document | |
header-includes: | |
- \usepackage{animate} | |
--- | |
`gganimate` now supports animations inside PDF documents. This feature is only | |
viewable with Acrobat Reader, however. Remember to include | |
`\usepackage{animate}` in the preamble and set `fig.show='animate'` in the chunk |
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(gganimate) | |
airq <- airquality | |
airq$Month <- format(ISOdate(2004,1:12,1),"%B")[airq$Month] | |
ggplot(airq, aes(Day, Temp, group = Month)) + | |
geom_line() + | |
geom_segment(aes(xend = 31, yend = Temp), linetype = 2, colour = 'grey') + | |
geom_point(size = 2) + | |
geom_text(aes(x = 31.1, label = Month), hjust = 0) + |
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
upper <- seq(0, pi, length.out = 181)[-181] | |
upper <-cbind(x = cos(upper), y = sin(upper)) | |
lower <- seq(pi, 2*pi, length.out = 181)[-181] | |
lower <- cbind(x = cos(lower), y = sin(lower)) | |
right <- seq(1.5*pi, 2.5*pi, length.out = 181)[-181] | |
right <- cbind(x = cos(right), y = sin(right)) | |
left <- seq(0.5*pi, 1.5*pi, length.out = 181)[-181] | |
left <- cbind(x = cos(left), y = sin(left)) | |
full <- cbind(x = cos(seq(0, 2*pi, length.out = 361)[-361]), | |
y = sin(seq(0, 2*pi, length.out = 361)[-361])) |
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
st_close <- function(x) { | |
UseMethod('st_close') | |
} | |
st_close.sfg <- function(x) x | |
st_close.POLYGON <- function(x) { | |
if (st_is_empty(x)) return(x) | |
x[] <- lapply(x[], close_mat) | |
x[vapply(x[], nrow, integer(1)) > 3] | |
} | |
st_close.MULTIPOLYGON <- function(x) { |
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(gganimate) # thomasp85/gganimate | |
library(cartogram) | |
library(geogrid) # Need github version jbaileyh/geogrid | |
library(rnaturalearth) | |
library(sf) | |
library(scico) | |
us <- ne_states('united states of america', returnclass = 'sf') | |
us <- us[!us$woe_name %in% c('Alaska', 'Hawaii'), ] | |
us <- st_transform(us, '+proj=eqdc +lat_0=39 +lon_0=-96 +lat_1=33 +lat_2=45 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs') |
NewerOlder