What's New in R: March 4, 2024
Welcome to this week’s edition of What’s New in R! This week, we’re featuring posts on the complete()
function from the {tidyr} package, new features in the table-making {gt} package, and a tutorial on adding logos to images. Let’s dive in!
You tidyr::complete()
me
Imagine you’ve got a dataset that looks like this:
As a human being (you are human, correct?), you can look at this and know that this means the dog got 0 walks on Thursday and the cat got 0 walks on Wednesday. But computers are computers and, being very literal, they don’t know this because there is no row with this data. How, then, can you get R to create all unique combinations of the variables?
Enter the complete()
function from the tidyr
package. In his blog post, You ‘tidyr::complete()’ me, Luis D. Verde Arregoitia (the same Luis D. Verde Arregoitia who teaches Data Cleaning with R) gives a nice walkthrough of this function. It’s the kind of function you don’t know you need until you do, at which point you don’t know how you ever lived without it!
All the new features in {gt} 0.10.0
The table-making package gt
has a new version out. It’s got a bunch of new features, including the ability to add so-called nanplots (for example, small line charts within tables). The nanplots can even be interactive, meaning users can hover over them and see tooltips that show the values. Check out the full announcement post by developer Rich Iannone to learn about nanoplots and several other new features in {gt} 0.10.0.
Adding a logo to images with {magick} and {purrr}
Have you heard of the coding cats? It’s an Esty shop selling R- and cat-themed swag. Its creator, Jadey Ryan, recently shared on LinkedIn how she used the {magick} and {purrr} packages to add the coding cats logo top the top left of promo images she uses to sell her swag on Etsy.
If you enjoyed this issue of What’s New In R, please share it with a friend! And if they want to get What’s New in R directly in their inbox, they can sign up on the R for the Rest of Us website.
Got any ideas for resources I should feature in future issues of What’s New in R? Leave a comment below!
Sign up for the newsletter
Get blog posts like this delivered straight to your inbox.
You need to be signed-in to comment on this post. Login.