Articles by Code R

A wrapper for the Climate Data Operators in R

July 1, 2024 | Code R

Today I’m extremely happy because I’ve finally been able to fulfil a dream of mine. And yes, by the end of this blogpost you might be worried about me for having such a weird, niche and, frankly, dumb dream, but I swear I’m fine! My dream was ...
[Read more...]

Kriging with metR

November 1, 2023 | Code R

Say you have data measured at different weather stations, which in Argentina might look something like this estaciones[data, on = c("nombre" = "station")] |__ ggplot(aes(lon, lat)) + geom_point(aes(color = t)) + geom_...
[Read more...]

Taking dependencies is actually good

October 27, 2023 | Code R

One of the recurring debates in some spaces of the R community is about dependencies. After a few posts on Mastodon I wanted to capture my opinions on the subject to help me understand them better, and because long-form articles are much better to t... [Read more...]

11 tricks to level up your rmarkdown documents

April 15, 2023 | Code R

For a while I wanted to write a post to compile some of the tricks I’ve learnt over the years of using rmarkdown. I also wanted other people’s input so I asked for suggestions on Mastodon. So here are the 12 tips I decided to include in no particula... [Read more...]

Making data available with dataset functions

February 19, 2023 | Code R

An important part of a scientific project, such as a journal paper or a PhD thesis, is accessing datasets. To keep things reproducible datasets should be accessible, either provided in the repository itself or in a remote location. Also for reproduc...
[Read more...]

Make error messages your own

July 12, 2021 | Code R

The stop() function allows you to terminate the execution of a function if there is a fatal problem. For example, imagine this code that calculates the square root of a number but only if the input number is positive. real_root [Read more...]

The new R pipe

May 24, 2021 | Code R

R 4.1.0 is out! And if version 4.0.0 made history with the revolutionary change of stringAsFactors = FALSE, the big splashing news in this next version is the implementation of a native pipe. The new pipe The “pipe” is one of the most distinctive qualities of tidyverse/dplyr code. I’m sure you’... [Read more...]

Star Trek ratings on IMDB

March 8, 2021 | Code R

My girlfriend and I are watching Star Trek: The Next Generation (TNG). The first season it’s pretty lame, but it gets better further down the line. That piqued my curiosity – is that impression shared by the rest of The Internets? So I decided to d...
[Read more...]

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...]

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...]

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 ...
[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 th...
[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...]
1 2

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)