Skip to content

Instantly share code, notes, and snippets.

View geotheory's full-sized avatar

Robin Edwards geotheory

View GitHub Profile
library(tidyverse)
set.seed(7)
N = 1000
x = rnorm(N)
p = plogis(0.2*x - 0.8)
y = rbinom(N, 1, p)
tibble(x, y) %>%
mutate(z = cut_number(x, 5)) %>%