Skip to content

Instantly share code, notes, and snippets.

View ndjrt's full-sized avatar

Russ Thomas ndjrt

View GitHub Profile
@MonkmanMH
MonkmanMH / gist:5802497
Created June 18, 2013 03:30
Annotating select points on an X-Y plot using ggplot2
#
# for details see
# http://bayesball.blogspot.ca/2013/06/annotating-select-points-on-x-y-plot.html
#
# load the ggplot2 and grid packages
library(ggplot2)
library(grid)
# read data (note csv files are renamed)
tbl1 = read.csv("FanGraphs_Leaderboard_h.csv")
tbl2 = read.csv("FanGraphs_Leaderboard_d.csv")
@nikdata
nikdata / reticulate-example.R
Created January 27, 2021 02:51
Using {reticulate}
library(reticulate)
library(palmerpenguins)
library(dplyr)
library(ggplot2)
library(extrafont)
df_pgs <- palmerpenguins::penguins
dplyr::glimpse(df_pgs)
@adrianolszewski
adrianolszewski / quantreg_mww.r
Last active September 7, 2025 09:17
Mann-Whitney (Wilcoxon) and Kruskal-Wallis FAIL to compare medians in general. Quantile regression should be used to compare medians instead
# Let's make some data to play with
set.seed(1234)
v1 <- rexp(500)
v2 <- rnorm(500) + log(2)
v3 <- -rgamma(500, 2.5, 3)
v4 <- runif(500, -2,4)
# Look at the data
layout(matrix(c(1:4), nrow = 2))
@battenr
battenr / model_diagnostics_ex-glm.R
Created September 5, 2025 14:50
Model Diagnostics - GLM
# Title: Model Diagnostics - Generalized Linear Model (GLM)
# Description: Demonstrating how we can explore model diagnostics
# using simulated data. For this specific use case, we are going
# to explore diagnostics for a generalized linear model (glm).
# Setup ----
#... Libraries ----