Publications by Code R
A wrapper for the Climate Data Operators in 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 to create an R wrapper for the Climate Data Operators (CDO) automatically from its documentation. CDO...
5739 sym R (1013 sym/7 pcs) 6 img
Taking dependencies is actually good
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 talk about contentious topics than short-burst posts. Dependencies are invitations for other people t...
9570 sym
11 tricks to level up your rmarkdown documents
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 particular order. Make chunk options non-optional I use this trick to force myself to write captions to a...
6055 sym Python (2353 sym/14 pcs)
Making data available with dataset functions
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 reproducibility, it’s important to be able to check if the data you get is the same as the data you expect....
4131 sym Python (1360 sym/3 pcs) 2 img
MIDI madness with ChatGPT: the AI-powered tunes that will make you laugh, cry, and dance
ChatGPT seems to be taking the world by storm. This is version of the GPT3 language model which is somehow optimised for chat dominates my Mastodon feed and inspired countless articles and discussion. 1 A decent chunk of the discourse has been about how the outputs of the models sound very plausible and even authoritative but lack any connection ...
27517 sym Python (15143 sym/19 pcs)
How to make a shaded relief in 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 I accidentally discovered is that one way of approximating this loo...
3155 sym R (6285 sym/6 pcs) 8 img
How to make a generic stat in ggplot2
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 I could create my own geoms I needed for my work or just for fun. But still, creat...
2302 sym R (3131 sym/5 pcs) 6 img
Wrapping around ggplot2 with ggperiodic
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°E you go back to 180°W. But ggplot2 and other plo...
4061 sym R (1703 sym/7 pcs) 8 img
Multiple color (and fill) scales with ggplot2
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 to this issue: Unfortunately, this deluge of qu...
3891 sym R (2086 sym/4 pcs) 6 img
Statistical metamerism
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 i...
11723 sym R (4182 sym/13 pcs) 12 img 2 tbl