Skip to content

Instantly share code, notes, and snippets.

@johnmyleswhite
johnmyleswhite / median.R
Created Feb 23, 2017
R's Medians as a Rabbit Hole of Type Promotions and Function Indirection
View median.R
> 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)
View types.markdown

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.