Skip to content

Instantly share code, notes, and snippets.

View StefanKarpinski's full-sized avatar

Stefan Karpinski StefanKarpinski

View GitHub Profile

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@johnmyleswhite
johnmyleswhite / median.R
Created February 23, 2017 00:40
R's Medians as a Rabbit Hole of Type Promotions and Function Indirection
> median(FALSE)
[1] FALSE
> median(c(TRUE, FALSE))
[1] 0.5
> median(c(TRUE, FALSE, TRUE))
[1] TRUE
> f <- factor(c('a', 'b', 'c'), levels = c('a', 'b', 'c'), ordered = TRUE)