Keybase proof
I hereby claim:
-
I am jonocarroll on github.
-
I am jonocarroll (https://keybase.io/jonocarroll) on keybase.
-
I have a public key ASBY3mLwKW3JR6kHm4Pb0RN9EJIp6G3X8nD9SJMhylURGAo
library(ggplot2) | |
library(dplyr) | |
## fake data | |
d <- mtcars %>% | |
group_by(cyl) %>% | |
summarise(lower = min(disp), | |
med = median(disp), | |
upper = max(disp)) | |
p <- ggplot(d, aes(x = factor(cyl), y = med)) + |
library(COVID19) | |
library(dplyr) | |
library(zoo) # rollmean | |
library(ggplot2) | |
library(ggeasy) # easy_add_legend_title | |
#### deaths #### | |
## gather USA data at state level and identify weekends | |
us <- covid19("USA", level = 2) %>% |
# Fork of https://gist.github.com/johnburnmurdoch/1d23978fc8213ff656d9f629608dd1f5/revisions | |
# modified to work with https://github.com/nacnudus/google-location-coronavirus | |
# Install and load required packages | |
# install.packages("needs") | |
# library(needs) | |
# needs(tidyverse, magrittr, animation, pdftools, png, scales) | |
library(tidyverse) | |
library(magrittr) | |
library(animation) |
library(htmltools) | |
library(d3r) | |
library(eulerr) | |
ui <- list( | |
attachDependencies( | |
tagList(), | |
d3_dep_v5() | |
), | |
titlePanel("Interactive Set Selector"), |
fastsort <- function(x, partial) { | |
y <- if (length(partial) <= 10L) { | |
partial <- .Internal(qsort(partial, FALSE)) | |
.Internal(psort(x, partial)) | |
} | |
else { | |
.Internal(qsort(x, FALSE)) | |
} | |
y | |
} |
using JuMP, GLPK | |
function graph_coloring(;fast=true, benchmark=false) | |
m = Model(with_optimizer(GLPK.Optimizer, msg_lev = 3)) | |
@variable(m, max_color, Int) | |
@variable(m, c[1:49,1:4], Bin) | |
@objective(m, Min, max_color) |
I hereby claim:
I am jonocarroll on github.
I am jonocarroll (https://keybase.io/jonocarroll) on keybase.
I have a public key ASBY3mLwKW3JR6kHm4Pb0RN9EJIp6G3X8nD9SJMhylURGAo
## create a copy of mtcars | |
m <- mtcars | |
## set every other value of cyl to NA | |
m$cyl <- m$cyl[c(TRUE, NA)] | |
## show a table of cyl vs am | |
table(m$cyl, m$am, useNA = "always") | |
# 0 1 <NA> | |
# 4 2 3 0 |
library(threed) | |
library(dplyr) | |
library(gganimate) | |
library(ggplot2) | |
angles <- tail(seq(0, pi/2, length.out = 15), -1) | |
camera_to_world <- threed::look_at_matrix(eye = c(1.5, 1.75, 4), at = c(0, 0, 0)) | |
objlist <- vector("list", length(angles)) |
library(rvest) | |
## GDP per capita, top 11 countries | |
n_countries <- 11 | |
url <- "https://en.wikipedia.org/wiki/List_of_countries_by_GDP_(nominal)_per_capita" | |
html <- read_html(url) | |
gdppc <- html_table(html_nodes(html, "table")[3])[[1]][1:n_countries, ] | |
## clean up; remove non-ASCII and perform type conversions | |
gdppc$Country <- gsub("Â ", "", gdppc$Country) |