Instantly share code, notes, and snippets.

View 00-start-end-higher-lower.R
library(ggplot2)
library(reshape2)
df <- data.frame(grp = 1:25, start = rnorm(25, 10, 5), end = rnorm(25, 5, 3))
df$end_higher <- df$start < df$end
mdf <- melt(df, id.vars = c("grp", "end_higher"))
names(mdf) <- c("grp", "end_higher", "category", "value")
mdf$grp <- factor(mdf$grp)
View 00-start-end.R
library(ggplot2)
library(reshape2)
# data setup
df <- data.frame(grp = 1:25, start = rnorm(25, 100, 10), end = rnorm(25, 10, 5))
# ** plotting using base plot functions
par(mfrow = c(1, 1))
rng <- range(df$start, df$end)
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View 00-plot-percentiles-by-boundaries.R
options(repos = c(CRAN = "http://cran.rstudio.com"))
install.packages("ggplot2")
install.packages("dplyr")
require(ggplot2)
require(dplyr)
points <- 10000
buckets <- 20
View keybase.md

Keybase proof

I hereby claim:

  • I am jeffreyiacono on github.
  • I am jfi (https://keybase.io/jfi) on keybase.
  • I have a public key whose fingerprint is 9313 2A1C 7607 9701 D3EF B96F 28F3 F2D8 4DE7 2229

To claim this, I am signing this object:

View 01-plots-with-manual-color-scale.R
d <- rnorm(1000)
df <- data.frame(x = seq(1, length(d), by = 1), y = d)
df$zscore <- (df$y - mean(df$y, na.rm = TRUE)) / sd(df$y, na.rm = TRUE)
ggplot(df, aes(x = x, y = y, group = abs(zscore) >= 1.95)) + geom_point(aes(color = abs(zscore) >= 1.95))
ggplot(df, aes(x = x, y = y, group = abs(zscore) >= 1.95)) + geom_point(aes(color = abs(zscore) >= 1.95)) + scale_color_manual(values = c("FALSE" = "grey", "TRUE" = "red"))
View blocks.rb
def something a, b, &block
sum = a + b
another_private_thing = "only something can see this"
puts "I'm in something, executing code."
puts "I added #{a} + #{b} and got #{sum}"
puts "and I can access my local vars: another_private_thing = #{another_private_thing}"
yield sum, another_private_thing
View galton_child_parent_height.R
library(UsingR)
library(ggplot2)
library(reshape)
data(galton)
freqData <- as.data.frame(table(galton$child, galton$parent))
names(freqData) <- c("child", "parent", "freq")
freqData$child <- as.numeric(as.character(freqData$child))
freqData$parent <- as.numeric(as.character(freqData$parent))
View fit-model-that-combines-predictors.R
library(ISLR)
library(ggplot2)
library(caret)
data(Wage)
# remove logwag as predicting wage, so this would be a pretty good predictor :)
Wage <- subset(Wage, select = -c(logwage))
# cross-validation data
View sigmoid.m
x = -10:0.1:10;
plot(x, 1 ./ (1 + e .^ -x))