Articles by Code R

Rammstein vs. Lacrimosa

November 20, 2019 | Code R

Some time ago, someone I follow on twitter posted about having to buy a whole book with rules to tease out grammatical gender in German. Further down the replies, someone reminisced about trying (and failing) to learn German just by listening to Rammstein’s lyrics. I studied about drei Jahre ...
[Read more...]

Why I love data.table

July 5, 2019 | Code R

I’ve been an R user for a few years now and the data.table package has been my staple package for most of it. In this post I wanted to talk about why almost every script and RMarkdown report I write start with:
library(data.table)
My memory issues I started ...
[Read more...]

Using ecmwfr to measure global warming

April 18, 2019 | Code R

For my research I needed to download gridded weather data from ERA-Interim, which is a big dataset generated by the ECMWF. Getting long term data through their website is very time consuming and requires a lot of clicks. Thankfuly, I came accross the nifty ecmwfr R package that allowed me ...
[Read more...]

Statistical metamerism

January 2, 2019 | Code R

Summary The metamer package implements Matejka and Fitzmaurice (2017) algorithm for generating datasets with distinct appearance but identical statistical properties. I propose to call them “metamers” as an analogy with the colorimetry concept. Metamers in vision This is not a prism separating white light into its component wavelengths. It is an ...
[Read more...]

Multiple color (and fill) scales with ggplot2

September 17, 2018 | Code R

tl;dr: The functionality shown in this post is now on the ggnewscale package! 📦. You can find the original code in this gist. A somewhat common annoyance for some ggplot2 users is the lack of support for multiple colour and fill scales. Perusing StackOverflow you can find many questions relating ...
[Read more...]

Wrapping around ggplot2 with ggperiodic

August 20, 2018 | Code R

As an atmospheric scientists, a lot of my research consists on plotting and looking at global fields of atmospheric variables like pressure, temperature and the like. Since our planet is a sphere (well, almost), it is unbound and so longitude is a periodic dimension. That is, to the right of 180°...
[Read more...]

How to make a generic stat in ggplot2

May 15, 2018 | Code R

For a while now I’ve been thinking that, yes, ggplot2 is awesome and offers a lot of geoms and stats, but it would be great if it could be extended with new user-generated geoms and stats. Then I learnt that ggplot2 actually has a pretty great extension system so ...
[Read more...]

How to make a shaded relief in R

February 3, 2018 | Code R

While trying to build a circular colour scale to plot angles and wind direction, I stumbled upon an easy way to make shaded reliefs in R. You known, when you look at cool maps of mountain areas where peaks and valleys are easily distinguishable from their shadows like this: What ...
[Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)