Search this site:

Recent Posts
Categories
 Follow David R. Roberts on WordPress.com
Category Archives: R
Ecologists: what we do vs. what we want people to think that we do
This occurred to me the other day while out working in the field for a day. I think back on all the photos I’ve posted of me doing rad stuff outside for work, like skiing through northern forests, flying around … Continue reading
Posted in graphics, R
Leave a comment
R code your Secret Santa exchange
Remember when everyone in the office/family would gather around and pull little pieces of paper out of a hat with names on them to decide who buys a secret Christmas gift for whom? Remember when people used to write on paper? … Continue reading
Space Invaders in R
So, for no particular reason except that it was kinda fun, I made some Space Invaders graphics in R. I even made the cool ‘Game Over’ text. Side note: this might be the first time that I’ve actually found the … Continue reading
Cycling gear ratio calculator for R (or why you should just go buy a SRAM Eagle 1×12 group right now)
Don’t care about R functions? Fine then. Jump past all the code to my analysis of single ring cyclocross setups or to my analysis of SRAM’s new 1×2 Eagle group. It took the end of a bottle of Jägermeister Winterkräuter to finish this … Continue reading
Posted in R, Sports
Tagged 12speed, bike, cassette, chainring, code, cycle, cyclocross, drivetrain, Eagle, gear inches, gearing, mountain bike, shift, Shimano, SRAM
4 Comments
Running pace and time calculator function for R
With an upcoming halfmarathon, I went looking online for a good race time and race pace calculator (of which there are some good simple ones and some more interesting ones). But let’s face it. What I really wanted was an R function … Continue reading
Posted in R, Sports
Tagged calculator, fitness, halfmarathon, kilometers, kilometres, marathon, miles, pace, running, time
1 Comment
Spatial leaveoneout (SLOO) crossvalidation
There are a variety of crossvalidation (CV) methods to deal with things like spatial autocorrelation, including the spatial leaveoneout (SLOO) approach. This is essentially a normal leaveoneout method where the area around the withheld point is buffered in space to … Continue reading
Posted in R
Tagged autocorrelation, buffer, code, crossvalidation, CV, evaluation, Leaveoneout, model, R, spatial
Leave a comment
Rescaling tricks in R
Not rocket science. Just parking this here for easy future access. R has the very useful scale() command for scaling vectors/matrices. This command takes a group of numbers, recentring the mean to 0 and standard deviation to 1. Essentially it’s … Continue reading
Posted in R
Leave a comment