This morning, I started a tutorial for folks whose knowledge of R is (like mine) stuck in 2001.
Yesterday I started reading the Rcpp book, and on page 4 there’s an example using the R function
replicate, which (a) I’d never heard before, and (b) is super useful.
I mean, I often write code like this, for a bootstrap:
x <- rnorm(2500) sapply(1:1000, function(a) quantile(sample(x, replace=TRUE), c(0.025, 0.975)))
But I could just be writing
x <- rnorm(100) replicate(1000, quantile(sample(x, replace=TRUE), c(0.025, 0.975)))
replicate must be some new function.” Yeah, new in R version 1.8, in 2003!
I’m in serious need of some re-education (e.g., I should be using more of Hadley Wickham’s packages). Hence the beginnings of a tutorial.
Note: the title was suggested by Thomas Lumley. No connection to @hspter; it’s not really so hip. I probably should have written “geeksteR.”