Maëlle's R blog

Showcase of my (mostly R) work/fun

Reducing my for loop usage with purrr::reduce()

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 package1, 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 post was featured on the R Weekly podcast by Eric Nantz and Mike Thomas.

Three useful (to me) R notions

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 escape hatch strategy, about which I wrote a post on the R-hub blog: you make part of your code responsive to an environment variable, and you locally set that environment variable in your tests.

Three useful (to me) R patterns

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: After reading Julia Evans’ post about blogging, I decided to train the blogging muscle a bit using these low-hanging fruits/toots1.

git and GitHub in R for the casual user

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 shared recommendations on Mastodon, whose names are acknowledged in the rest of the post!

RSS, fantastic tool for keeping up-to-date

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 Have a look at the RSS feed for this blog over at https://masalmon.