Last month, Vicki Boykis recommended the book “Code that Fits in Your Head” by Mark Seemann. I was intrigued, especially by her takeaway that “Writing good software should be a slow and deliberate craft”. The book reminded of The Pragmatic Programmer in the breadth of topics it covers. However, I much preferred its tone. Sustainability Throughout the book, the author makes…
Here I am again, writing about crochet and programming! I’ve continued creating my tons of shitty stitches cute creatures. New Git analogy! The crochet lifeline First Git/crochet analogy . I read a great crochet book about creating your own amigurumi patterns: Créer ses propres modèles d’amigurumis au crochet by Clotilde Massot and Lise Grandjonc. One of its authors (Clotilde Massot) is a…
I’m not mad when current AI tools or tips 1 make Git look cool and important. Something old and stable to cling to! 🤗 In particular, it’s now trendy to have agents work on different tickets in the same project in parallel by using Git worktrees . Git worktrees are even useful for us humans, even if we should probably not work on a dozen things at the same time. I had learnt about Git…
I’m currently on a quest to better know and understand treesitter-based tooling for R. To make it short, treesitter is a tool for parsing code, for instance recognizing what is a function, an argument, a logical in a string of code. With tools built upon treesitter you can search , reformat , lint and fix , etc. your code. Exciting stuff, running locally and deterministically on your…
A while ago, I decided to learn some Rust. I bought a book, opened it months later and started a small side-project: porting my R package saperlipopette to the terminal by writing a CLI with Rust. I then lost steam and discarded the project. Now, teaching more Git with saperlipopette has me itching to do the same outside of R, to reach more learners. And in the meantime, even though I have…
In which I share a crochet analogy for Git commits… This post was featured on the R Weekly highlights podcast hosted by Eric Nantz and Mike Thomas. Don’t forget your stitch markers! I am happily continuing my crochet learning journey . One lesson I have now internalised is that I should never ever forget or neglect to use stitch markers. Stitch markers are sort of small, not spiky, safety pins. A…
Thanks to Athanasia Mo Mowinckel for reviewing this post! One goal of mine this year is to learn how to crochet amigurumi , that is to say, cute creatures. When working on my first project, a cat toy made out of yarn left-over from knitting projects, I thought of some similarities between this activity and being a beginner in programming. Here they are! This poor bee has heart wings……
Coming to you from France, a post about Mise en place for R projects. In a less francophone phrasing: to get to work on something you have to open that thing, be it a script or a project or a website. The easier that is, the faster you get to work. In this post I’ll show a roundup of R functions and related tools for opening scripts, projects and websites for yourself or on behalf of the…
I’ve recently been dealing with legacy code refactoring both in theory and in practice: while I’m continuing some work on the igraph R package, I’ve started reading Working Effectively with Legacy Code by Michael Feathers , that had been in my to-read pile for months. In this post, I’ll summarize some ideas from both the book and my work. “Cover and modify” with…
This post contains mistakes! No need for a roclet for custom tags! Use the packages load option . Refer to the roxygen2 vignette . This post was featured on the R Weekly highlights podcast hosted by Eric Nantz and Mike Thomas. You might know that it’s possible to extend roxygen2 to do all sorts of cool things including but not limited to: documenting your internal functions for developers…
Earlier this year I wrote a post about git worktree that allows you to load different versions of an R package at once on your computer. To keep with the “juggle between versions of a codebase with Git plant-related commands” theme, let me show you how I use cherry-pick to assess the quality of an unit test. Scenario: you fix a bug in a branch In a perfect world, the bug you’re…
This post was featured on the R Weekly highlights podcast hosted by Eric Nantz and Mike Thomas. Writing good code is hard. Some aspects get easier with experience – although I observe that I consistently forget some things. 🙈 Other aspects can be tackled through code review – although your reviewer’s time will be better spent on design questions than on nitpicks. 💅 Static code…
Coming back from a conference, we might be excited to install and try out the cool things we have heard about. I, going against the stream 🐟, decided to experiment with a tool I have not heard about last week, as I unfortunately missed Davis Vaughan’s talk about treesitter . Nonetheless, I caught the idea that treesitter is a parser of code, R code in particular. The treesitter R package…
Last week after my useR! talk , someone I had met at the R-Ladies dinner asked me for a list of all the links in my slides. I said I’d prepare it, not because I’m a nice person, but because I knew it’d be an use case where the great tinkr package would shine! 😈 What is tinkr? tinkr is an R package I created , and that its current maintainer Zhian Kamvar took much further that…
I’ve now explained on this blog why it’s important to have small, informative Git commits 1 and how I’ve realized that polishing history can happen in a second phase of work in a branch . However, I’ve more or less glossed over how to craft the history in a branch once you’re done with the work. I’ve entitled this post “Hack your way to a good Git…
This post was featured on the R Weekly highlights podcast hosted by Eric Nantz and Mike Thomas. “Make small Git commits with informative messages” is a piece of advice we hear a lot when learning Git. That’s why we might want to sometimes rewrite history in a branch . In this post, I’d like to underline three main (😉) reasons why you’ll be happy you, or someone else,…
This post was featured on the R Weekly highlights podcast hosted by Eric Nantz and Mike Thomas. I’m currently refactoring test files in a package. Beside some automatic refactoring , I am also manually updating lines of code. Here are some tips (or pet peeves, based on how I look at it / how tired I am 😁) Prequel: please read the R packages book The new edition of the R Packages book by…
Once again a post praising XML . 😇 These are notes from a quite particular use case: what if you want to replace the usage of a function with another one in many scripts, without manual edits and without touching lines that do not contain a call to replace? The real life example that inspired this post is the replacement of all calls to expect_that(..., equals(...)) , like expect_that(a,…
I recently re-read Nadia Eghbal’s Working in public . This time around, I noticed her mention of the book “Producing open source software” by Karl Fogel . It is a book about the people aspects of open-source projects, including money, and it reads like a sort of guide. Complying with my first-edition-curse , I did not notice there was a second edition online and soonish to be in…
This post was featured on the R Weekly highlights podcast hosted by Eric Nantz and Mike Thomas. Do you ever see GitHub issue comments where someone posts the results of a reprex with a current package version, and then with an older one, to prove a regression? How would you go about preparing such a report? Today I learnt there is a clean way to have different versions of a codebase at once on…
As mentioned about a million times on this blog, last year I read Git in practice by Mike McQuaid and it changed my life – not only giving me bragging rights about the reading itself. 😅 I decided to give Pro Git by Scott Chacon a go too. It is listed in the resources section of the excellent “Happy Git with R” by Jenny Bryan, Jim Hester and others. For unclear reasons I bought…
I got more confident with Git since reading Git in practice . This has resulted in a more enjoyable Git practice! I’m also more keen to sharing Git “tips” with others, but felt it was challenging to quickly come up with examples to demo some Git workflows. This is what motivated my creating saperlipopette, an R package containing small Git playgrounds to practice various Git…
In my quest to having reading notes on the tech books I read, and while waiting for code to run, I recently re-read The Pragmatic Programmer by David Thomas and Andrew Hunt. That book, whose second edition was published in 2019, offers an overview of many topics useful to programmers, from the idea of taking responsability, to testing, tooling, etc. Not my favorite tone I’m not the biggest…
I seem to have at last entered my Git era. 🎉 Reading and applying Git in practice was probably the best thing I did for my upskilling this year. One Git workflow aspect I’ve finally realized is that it’s fine to have two phases of work in a Git branch. I’ll explain it in this post. Set up: create a branch for your work! Ideally, in most cases, when adding a feature or fixing a…
Another month, another long train trip enjoyed in the company of great books, among which a work-related one, Kill it with fire by Marianne Bellotti . As indicated by its subtitle “Manage Aging Computer Systems (and Future Proof Modern Ones)”, the book deals with handling legacy computer systems. The focus is on bigger projects (including serious internal politics) than what I usually…
I somewhat regularly teach about package development. One recent example was a workshop for rOpenSci champions . I am improving my teaching over time (thankfully 😅) but one thing I have down by now is the intro, which is mostly my throwing together my favorite quotes about R package development ! Let me write it up. Where I explain why people shouldn’t flee the workshop After boasting a bit…
My sticky note filled up quickly after I only added setNames() on it, with related functions for dealing with object names, in base R and beyond! (Un)Setting object names: stats::setNames() , unname() and rlang::set_names() I noticed a function ending with something like this: blop <- function ( ) # code creating the df data.frame # ... names ( df ) <- c ( 'col1' , 'col2' ) df It struck me as…
While preparing materials for teaching Git a few months ago, I re-read Suzan Baert’s excellent post about Git and GitHub , where she mentioned having read “Git in Practice” by Mike McQuaid . I added the book to my Momox alerts, where it got available a few weeks later. The book source is on GitHub . The book isn’t too heavy, so I took it with me on a long train journey! 🚋…
Time for me to throw away my sticky note after sharing what I wrote on it! grep(...) not which(grepl(...)) Recently I caught myself using which(grepl(...)) , animals <- c ( 'cat' , 'bird' , 'dog' , 'fish' ) which ( grepl ( 'i' , animals ) ) #> [1] 2 4 when the simpler alternative is animals <- c ( 'cat' , 'bird' , 'dog' , 'fish' ) grep ( 'i' , animals ) #> [1] 2 4 And should I need the values…
When I see a book recommendation somewhere, be it for work or leisure, I often either order the book or set an alert in my favorite online second-hand bookstore . By the time I am notified the book is available, I sometimes don’t remember why I listed it! That’s what happened for the book A Philosophy of Software Design by John Ousterhout. I decided to trust my past self and buy it.…
This post was featured on the R Weekly highlights podcast hosted by Eric Nantz and Mike Thomas. Following last week’s post on my testing workflow enhancements , Jenny Bryan kindly reminded me of the existence of an actual reset button when you’ve been interactively running tests that include some “local mess”: withr::local_envvar() , withr::local_dir() ,…
I spend a lot of quality time with testthat, that sometimes deigns to praise my code with emojis, sometimes has to encourage me. No one gets it right on their first try apparently? Anyway, in honor of testthat 3.2.0 release 🎉 👏, I’d like to mention two small things that improved my testing workflow a whole lot! Running one single test at a time Under testthat 3.2.0 minor features lies a…
This post was featured on the R Weekly highlights podcast hosted by Eric Nantz and Mike Thomas. In November I’ll give a talk about multilingualism in R at the Spanish R conference in Barcelona (😍). I can’t wait! Until then, I need to prepare my talk. 😅 I plan to present the rOpenSci “multilingual publishing” project but also other related tools, like potools. In this…
Straight from my sticky note, three functions that I like a lot, despite their not being new at all… But maybe new to some of you? sprintf() , the dependency-free but less neat “glue” Imagine I want to tell you who I am. I could write name <- whoami :: fullname ( ) github_username <- whoami :: gh_username ( ) glue :: glue ( 'My name is name and you'll find me on GitHub as…
My sticky note is full! And luckily all functions on it can be squeezed into a similar topic: making things smaller! Make lists smaller with purrr::compact() , purrr::keep() , purrr::discard() Once upon a time there was a list (isn’t this the beginning of all R scripts?!) my_list <- list ( name = 'Maëlle' , city = 'Nancy' , r_problems_encountered = Inf , python_skills = NULL ) Imagine you…
There are already three functions of note on a piece of paper on my desk, so it’s time to blog about them! This post was featured on the R Weekly podcast by Eric Nantz and Mike Thomas. How does this package depend on this other package? pak::pkg_deps_explain() The pak package by Gábor Csárdi makes installing packages easier. If I need to start working on a package, I clone it, then run…
I (only! but luckily!) recently got introduced to the magic of purrr::reduce() . Thank you, Tobias ! I was told about it right as I was unhappily using many for loops in a package 1 , for lack of a better idea. In this post I’ll explain how purrr::reduce() helped me reduce my for loop usage. I also hope that if I’m doing something wrong, someone will come forward and tell me ! This…
Following my recent post on three useful (to me) R patterns , I’ve written down three other things on a tiny sticky note. This post will allow me to throw away this beaten down sticky note, and maybe to show you one element you didn’t know? nzchar() : “a fast way to find out if elements of a character vector are non-empty strings” One of my favorite testing technique is the…
This post was featured on the R Weekly highlights podcast hosted by Eric Nantz and Mike Thomas. I’m happy to report that I thought “oh but I know a better way to write that code!” a few times lately when reading old scripts of mine, or scripts by others. It’s a good feeling because it shows progress! I’ve tooted about all three things I’ll present in this post:…
If you’ve been taught git and GitHub but practice so rarely that you’re discouraged, what should you do to re-start more easily? Let’s imagine you have to, or really want to, use git and GitHub for your next analysis project. Here’s what I would recommend… I assume you already own a GitHub account. If not, refer to happygitwithr guidance . Thanks to the people who…
I found an excuse to blog about XML again ! Yes, RSS feeds are in practice XML, but for most people, that’s not why they are cool. An RSS ( really simple syndication ) feed is metadata about all, or the most recent posts published by a website: publication date, content or summary, etc. Much handier in my opinion to use that to get updates among Twitter “noise”. RSS feed example…
One of my favorite tool is XPath, the query language for exploring XML and HTML trees. In this post, I will highlight a few use cases of this “angle-bracket crunching tool” and hope to convince you that it’s an awesome thing to know about and play with. Many thanks to Christophe Dervieux for useful feedback on this post! Mille mercis ! Brief intro to XPath in R Say I have some…
I’m spending quite a lot of my working time on GitHub, so have taken some habits. Maybe some of them can be useful to you! 1: How to get started I’ve never actually taught git and GitHub, but I like sharing these useful links: Happy Git and GitHub for the useR by Jenny Bryan, the STAT 545 TAs, Jim Hester. It includes a big picture section “Why Git? Why GitHub?" . Reflections on 4…
Huge thanks to Hannah Frick for her useful feedback on this post! Vielen Dank! This post was featured on the R Weekly podcast by Eric Nantz. When trying to fix a bug or add a feature to an R package, how do you go from viewing the code as a big messy ball of wool, to a logical diagram that you can bend to your will? In this post, I will share some resources and tips on getting better at debugging…
I’ll be giving a remote keynote talk at the Rencontres R (French R conference) on July the 12th, all in French. This blog post is a written version of my presentation, but in English. I decided to not talk about package development for once, but rather about workflows and how to structure & run an analysis. 1 Many thanks to Christophe Dervieux for useful feedback on this post! Merci beaucoup…
Edit: now there is an R package for server-side MathJax rendering, katex by Jeroen Ooms . Whilst I most certainly do not write LaTeX formulas on the regular anymore, I got curious about their MathJax rendering on websites. 1 In brief : your website source contains LaTeX code, and the MathJax JS library (self-hosted or hosted on a CDN) transforms it into something humans can understand: some HTML…
I’ve just finished teaching blogging with R Markdown at R-Ladies Bangalore . This has two consequences: I need to calm down a bit after the stress of live demoing & co, and I am inspired to, well, blog with R Markdown! As I’ve just read a fascinating book about the beanie baby bubble and as I’ve seen rvest is getting an update, I’ve decided to harvest Beaniepedia . Both of…
My kids got a cool electronic storyteller as a gift. It is basically a pretty cube that you shake to make it play tracks. La conteuse merveilleuse comes with pre-loaded songs and stories, but you can also add your own. Very handy, as we had e.g. CDs that came with magazines. According to the anti-manual 1 , to add a mp3 or wav file you own, you first need to convert it to the storyteller’s…
A big part of my work includes putting content about R online, in blog posts and online books. I’m therefore very interested in the technical infrastructure that allows us R users to produce beautiful products out of R Markdown or Markdown source files. In this post I shall summarize my recent experiments around making HTML and PDF versions of books. Thanks to Julie Blanc’s inspiring…
Last week I had the pleasure to lead an online course about “Scientific Blogging with R Markdown”, invited by Najko Jahn and Anne Hobert from SUB Göttingen . To follow the example set by the incredible Alison Hill , I’ll write a summary of what I’ve learnt and would like to do better next time. The topic The topic of the course was “Scientific Blogging with R…