Skip to content

Instantly share code, notes, and snippets.

@seankross
seankross / jazz.txt
Created May 18, 2018
Jazz Toni Morrison
View jazz.txt
From "Jazz" by Toni Morrison
It's nice when grown people whisper to each other under the covers. Their
ecstasy is more leaf-sigh than bray and the body is the vehicle, not the point.
They reach, grown people, for something beyond, way beyond and way, way down
underneath tissue. They are remembering while they whisper the carnival dolls
they won and the Baltimore boats they never sailed on. The pears they let hang
on the limb because if they plucked them, they would be gone from there and who
else would see that ripeness if they took it away for themselves? How could
anybody passing by see them and imagine for themselves what the flavor would
@seankross
seankross / schools.R
Created Mar 29, 2018
Graph for Clare
View schools.R
# You can find pch values for shapes here:
# https://cdn-images-1.medium.com/max/1600/1*0QEVFHrgqmkVsCVCQceh6w.jpeg
data <- data.frame(
Name = c("Ohio State", "Purdue", "Indiana", "Wisconsin", "Nebreaska"),
Min = c(0.37, 0.25, 0.13, 0.22, 0.28),
Max = c(0.88, 0.57, 0.68, 0.77, 0.63),
Value = c(0.51, 0.32, 0.24, 0.65, 0.57),
Pch = c(1, 2, 5, 6, 22),
stringsAsFactors = FALSE
@seankross
seankross / emilyp.R
Created Mar 7, 2018
Getting p-values out of a model, two ways
View emilyp.R
berkeley <- as.data.frame(UCBAdmissions)
model <- glm(Admit ~ Gender + Dept + Freq, data = berkeley, family = "binomial")
# Base R
model_summary <- summary(model)
model_summary$coefficients[,4]
# Or become one of the cool kids
View file2777293d5bd5.R
library(shiny)
library(miniUI)
ui <- miniPage(
gadgetTitleBar("My Gadget"),
miniContentPanel(
## Your UI items go here.
)
)
View stephan.R
library(dplyr)
c(2, 5, 6) %>% sum()
cars_i_want <- mtcars %>%
filter(mpg > 20) %>%
filter(cyl == 4) %>%
arrange(hp)
mtcars %>%
View expected.R
steph <- structure(c(148L, 65L, 198L, 53L, 16L, 2004L), .Dim = c(3L, 2L
), .Dimnames = structure(list(c("EatNoTrans", "Request", "Stealing"
), c("0", "1")), .Names = c("", "")), class = "table")
chisq_steph <- chisq.test(steph)
chisq_steph$expected
@seankross
seankross / install_ffmpeg_ubuntu.sh
Last active May 14, 2020 — forked from xdamman/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04
View install_ffmpeg_ubuntu.sh
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
View bootstrapped_rmse.R
library(dplyr)
library(purrr)
set.seed(2017-06-27)
# Imagine this function gives us measurements from nature
data_generator <- function(n = 500){
data_frame(var1 = rnorm(500)) %>%
mutate(var2 = var1 + rnorm(500)) %>%
mutate(var3 = var1 * var2 + rnorm(500)) %>%
View plot_sound.R
library(aws.polly)
jeff <- synthesize("Hello, I am Jeff Leek. Take a look at this chart on my left.", "Joey")
plot(jeff@left, type = "l")
View strata.R
library(dplyr)
x <- mtcars %>%
group_by(cyl) %>%
sample_frac(replace = TRUE)
mtcars %>%
group_by(cyl) %>%
summarise(sum = n())
You can’t perform that action at this time.