All Posts

Who you gonna call? R processes!

Aside from the workshops and talks at #rstudioconf back in January, I picked up many useful nuggets from the stream of conference tweets. I was particularly struck by this one: Tired: Load R scripts with source() Wired: Load R scripts with callr — Travis Gerke (@travisgerke) January 18, 2019 Not feeling the amazement? Okay, let me explain… Loyal readers may remember my previous blogpost, in which I described starting a new R process to run a plumber API for testing.

Encoding in R

Every once in a while I complain on Twitter when I try to mix non-English letters with R. I am certainly not the first person to be frustrated by encoding issues, though I am (maybe too) hopeful that the problems won’t last for much longer. We live in the age of vacuum bots and 3D-printing, so what makes multi-language support so complicated? Trying to mix Hebrew with #rstats is a bit of a nightmare, but at least it led me to this amazing "String encoding and R" blogpost by @kevin_ushey.

Iterative testing with plumber

This summer, I fiddled around with plumber, an R package for creating your very own web API. I got my start with Jeff Allen’s webinar, “Plumbing APIs with plumber” (slides here). I later dug into the topic some more using the plumber bookdown, along with a lot of trial and error. In this blogpost, I’ll highlight how I gradually improved on my plumber building/testing workflow and eventually automated my testing steps.

A summer of puzzles at RStudio

This summer, I teamed up with Jenny Bryan to create a series of coding puzzles, which (fingers crossed!) will be released next spring. It was exciting to start a project from the ground up, growing and shaping it over the 10-ish weeks of the internship. Project background The Advent of Code puzzles were a major source of inspiration for the project. I spent a fair amount of my winter holidays last year solving the Advent of Code in R.

A Tale of Two Testing Environments

Background Lesson 1: check suggested packages Lesson 2: MODULARIZE + use vagrant scripts with caution Internet solutions Conclusion Today marks the second time I’ve debugged the problem of tests that pass with devtools::test() but fail with devtools::check(). Since I’m now riding my debug-success high (and hope never to repeat this again), here is a blogpost. Background There are some resources online (see below) to help with debugging this particular problem, but they are sparse and situation-specific.

FUNctional programming tricks in httr

httr basics On with the tricks! Embrace the backtick The null-default operator %||% Check argument inputs with match.arg() switch() out your if-elses Strange bedfellows tl;dr - do read the source code! Over the past few months, I worked on several projects that involved accessing web API’s in R, which meant I spent a lot of time puzzling over the functions and code in the httr package.

Rats to reefs

This week, I came across two news articles about a study in Nature led by Nick Graham that linked invasive rats on islands to coral reefs. I was intrigued by how the different authors (in this case, Ed Yong from the Atlantic and Victoria Gill from the BBC) reported on the study, and took it as a sign that I have should some fun with text analysis. Rats on islands eat all the seabirds --> less guano --> less nitrogen flowing into the sea --> fewer fish in offshore coral reefs.