Maëlle's R blog

Showcase of my (mostly R) work/fun

Two recent enhancements to my testing workflow

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 small gem:

How to translate your package's messages with {potools}

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 post, I’ll walk you through a minimal example of using potools to translate messages in an R package!

3 R functions that I enjoy

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 {github_username}!") #> My name is Maëlle Salmon and you'll find me on GitHub as maelle!

R functions that shorten/filter stuff: less is more

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 want to get rid of NULL elements.

Three (four?) R functions I enjoyed this week

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 pak::pak() to install and update its dependencies.