I hereby claim:
- I am conjugateprior on github.
- I am conjugateprior (https://keybase.io/conjugateprior) on keybase.
- I have a public key whose fingerprint is 5D5B 2B00 382C E647 8B68 87D0 0AC2 609A 0570 BA8A
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
library(magrittr) | |
library(stringr) | |
library(ggplot2) | |
library(rvest) | |
make_data <- function(sex=c("M", "F")){ | |
sex <- match.arg(sex) | |
addr <- paste0('http://www.sexymp.co.uk/index.php?gender=', sex, '#vote') | |
gg <- read_html(addr, encoding="ISO-8859-1") |
```{r} | |
## make sure the two columns of data are next to each other and have column headers | |
## highlight and copy them, including their headers. If the headers are, e.g. 'treatment' and 'control' | |
## on a Mac | |
ff <- read.delim(pipe('pbpaste')) | |
## on Windows | |
ff <- read.delim("clipboard") |
library(dplyr) | |
library(stringdist) # for approximate matching with 'amatch' | |
DB1 <- data_frame(name1 = c("John Q. Smith", "Sajeet Rau", | |
"Federico K. Giordino"), | |
judge_variable = c(1, 2, 3)) | |
DB2 <- data_frame(name2 = c("John Smith", "John Q. Smith", | |
"F. K. Giordino","Federico K. Giordino"), | |
case_variable = c(1, 1, 1, 2)) |
#!/usr/bin/env bash | |
read -p "GitHub username: " username | |
read -s -p "GitHub password: " password | |
echo | |
read -p "Github repository name: " repo | |
up="$username:$password" | |
ur="$username/$repo" |
fourfold_box <- function(bl_br_tl_tr, # values for bottom left, top right, etc. | |
cols = rep(rgb(0.8, 0.8, 0.8), 4), # default to grey fill | |
labels = NULL, # use these instead of bl, br, tl, and tr values | |
label.cols = rep("black", 4), # value colors | |
quadrant.labels = NULL, # default: don't label quadrants | |
quadrant.label.col = NULL, # default: "black" | |
small.min = 5, # center label in box unless it's smaller than this | |
small.label.mult = 1.5, # label this multiple of box side length further out | |
axis.lwd = 1, # crossbar thickness | |
axis.col = NULL, # default: "black" |
# convenience function for logit models | |
invlogit <- function(x){ 1 / (1 + exp(-x)) } | |
# some data cribbed from the R help pages | |
dd <- data.frame(ldose = rep(0:5, 2), | |
dead = c(1, 4, 9, 13, 18, 20, 0, 2, 6, 10, 12, 16), | |
sex = rep(c("M", "F"), each = 6)) | |
# 30 trials in each row of which 'dead' beasties died | |
# fit a model |
```{r} | |
library(MonetDBLite) | |
library(RSQLite) | |
library(DBI) | |
library(dplyr) | |
library(microbenchmark) | |
library(ggplot2) | |
``` |
library(tidyverse) | |
page <- "https://www.newsobserver.com/news/politics-government/election/article100235752.html" | |
decreasers <- read_html(page) %>% # grab and parse the webpage | |
html_table %>% | |
pluck(1) %>% # first (and only) table | |
mutate(h2016 = parse_number(`2016 Hours`), # parse ugly number formats | |
h2012 = parse_number(`2012 Hours`), | |
County = toupper(County)) %>% | |
filter((h2016 - h2012) < 0) %>% |
# install.packages(c("jsonlite", "dplyr")) | |
library(jsonlite) | |
library(dplyr) | |
json <- "https://www.sutterhealth.org/for-patients/chargemaster-2019.json" | |
cmr <- read_json(json) | |
gg <- bind_rows(lapply(cmr$CDM, as.data.frame)) | |
head(gg) # ok, now what... |