I hereby claim:
- I am thomasp85 on github.
- I am thomasp85 (https://keybase.io/thomasp85) on keybase.
- I have a public key ASDRGUror8ScAXuoC-MJVs06sOwPsdpyP9RU3GrLfkKU9Qo
To claim this, I am signing this object:
library(ggplot2) | |
library(gganimate) | |
library(sf) | |
earth <- sf::st_as_sf(rnaturalearth::countries110) | |
views <- data.frame(rbind( | |
st_bbox(earth[earth$name == 'Denmark',]), | |
st_bbox(earth[earth$name == 'Australia',]) | |
)) | |
p <- ggplot() + | |
geom_sf(data = earth, fill = 'white') + |
library(sf) | |
library(ggplot2) | |
library(gganimate) | |
# Data from personal correspondance | |
# Collapse all dates to the same year | |
d$year <- format(d$date, '%Y') | |
d$stand_time <- as.POSIXct(paste0('2000-', format(d$date, '%m-%d %T'))) |
library(gapminder) | |
library(ggplot2) | |
library(gganimate) | |
p <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, colour = country)) + | |
geom_point(alpha = 0.7) + | |
scale_colour_manual(values = country_colors) + | |
scale_size(range = c(2, 12)) + | |
scale_x_log10() + | |
facet_wrap(~continent) + |
library(ggraph) | |
library(tidygraph) | |
library(gganimate) | |
# Data from http://konect.uni-koblenz.de/networks/sociopatterns-infectious | |
infect <- read.table('out.sociopatterns-infectious', skip = 2, sep = ' ', stringsAsFactors = FALSE) | |
infect$V3 <- NULL | |
names(infect) <- c('from', 'to', 'time') | |
infect$time <- as.POSIXct(infect$time, origin = Sys.time() - as.numeric(Sys.time())) |
library(magick) | |
library(reshape2) | |
library(dplyr) | |
library(tidygraph) | |
library(particles) | |
library(animation) | |
plot_fun <- function(sim) { | |
df <- as_tibble(sim) | |
plot(df$x, df$y, col = df$color, pch = '.', axes = FALSE, xlim = c(-100, 317), ylim = c(-268, 100), xlab = NA, ylab = NA) |
library(tidygraph) | |
library(particles) | |
library(jsonlite) | |
library(magick) | |
# Prepare text polygons | |
text <- read_json('text.json') | |
par_text <- text$layers[[3]]$paths | |
on_text <- text$layers[[2]]$paths | |
cran_text <- text$layers[[1]]$paths |
--- | |
title: "R Notebook" | |
output: html_notebook | |
--- | |
# Difference in behavior between ggplot2 and patchwork plots in Notebooks | |
Consider the following ggplot | |
```{r} |
library(future) | |
trim_model <- function(model, predictor = predict, ..., ignore_warnings = TRUE) { | |
# Cache the correct output | |
true_pred <- predictor(model, ...) | |
# Treat prediction warnings as errors? | |
if (!ignore_warnings) { | |
old_ops <- options(warn = 2) | |
on.exit(options(old_ops)) | |
} |
I hereby claim:
To claim this, I am signing this object:
library(ggforce) # need github version | |
library(tweenr) | |
library(animation) | |
# Define the different states | |
controls <- list( | |
data.frame( | |
x = runif(6), | |
y = runif(6), | |
col = 'steelblue', |