The power of choice is in full effect! How you can leverage GitLab to publish your next Quarto document online, how to bring key R functional paradigms to a Python session, and adding a larger safety net with your unit tests with {mutagen} 0.2.0. Episode Links This week's curator: Jon Carroll - @jonocarroll@fosstodon.org (Mastodon) & @jonocarroll.fosstodon.org.ap.brid.gy (Bluesky) & @carroll_jono (X/Twitter) Deploying Quarto documents with GitLab Functions over Idioms - Writing R in Python with rfuns muttest 0.2.0: More Mutators, Better Reporting, and Parallel Execution Entire issue available at rweekly.org/2026-W22 Supplement Resources Data Science at the Command Line https://datascienceatthecommandline.com/ DevOps for Data Science https://do4ds.com/ {pak} System Requirements https://pak.r-lib.org/reference/sysreqs.html Supporting the show Use the contact page at https://serve.podhome.fm/custompage/r-weekly-highlights/contact to send us your feedback R-Weekly Highlights on the Podcastindex.org - You can send a boost into the show directly in the Podcast Index. First, top-up with Alby, and then head over to the R-Weekly Highlights podcast entry on the index. A new way to think about value: https://value4value.info Get in touch with us on social media Eric Nantz: @rpodcast@podcastindex.social (Mastodon), @rpodcast.bsky.social (BlueSky) and @theRcast (X/Twitter) Mike Thomas: @mike_thomas@fosstodon.org (Mastodon), @mike-thomas.bsky.social (BlueSky), and @mike_ketchbrook (X/Twitter) Music credits powered by OCRemix Wrestling with Double Bass - Street Fighter II - Malcos - https://ocremix.org/remix/OCR01270 A Simple Flip can Change Fate - Final Fantasy VI - Level 99 - https://ocremix.org/remix/OCR02692
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
Hello friends, we are back with episode two twenty eight of the Our WikiHowards podcast. We are slightly later than usual because yours truly has a hectic conference schedule this week and next week, but we are back on the airwaves this week. And thank you so much for joining us from wherever you are around the world. And if you're new to the show, this is the weekly podcast where we talk about the awesome resources that made the highlights section along with other goodies in this week's issue of R Weekly at rweekly.org.
My name is Eric Nance, and I'm delighted that you joined us once again, and we are already closing out the month of May. It does not seem real, but yeah, summer is here for many of us unofficially and officially, but I'm not alone this time either. So I'm joined by my cohost, Mike Thomas. Mike, how are you doing today? Can't complain. It's a Friday, Eric. And now that we have these new Friday recording times, it, you know, the Friday's a little puts a little more pep in our step, I think. So, hopefully, that It does. Shows out to the audience.
Yep. And, also, speaking of, you know, pep in my step, I am at literally back from a two and a half day ish conference. I was literally right here in my neck of the woods called the Midwest Biopharmaceutical Statistics Workshop. I met a lot of good colleagues there and some old familiar faces. So if you said hi to me at the conference and you listened to the show, glad you made it to our weekly. But nonetheless, we'll get things kicked off here with our show proper. And our curator this week is Jonathan Carroll, another one of our longtime curators on the team. And as always, had tremendous help from our fellow RWEAPY team members and contributors like all of you around the world with your poll requests and other terrific suggestions.
And as Mike and I talk about a lot on this show, one of the best parts of being an open source and all the tooling we have is the choice we have available. Certainly choice in the packages we use, but when you kind of toe the line between open source and services that often augment these solutions, we do have choice in that as well. Granted, there are some platforms that have maybe a stronger foothold or footprint in a lot of our data science pipelines,
but we do have choice in this. And I would say over recent events, this is becoming a lot more important than ever. Case in point, our first highlight here comes to us from Nicole O'Reny, another very frequent contributor to Our Weekly, and she has a great new blog post talking about Cordo, which again is a very familiar topic to us, but with another method of deploying these online, your Cordo documents, with another service that's not GitHub.
This time we're talking about GitLab. Now, I will, try to watch my words here a little bit, but if you've been reading stuff online, GitHub's had a tad bit of reliability issues lately, some hacking here and there, and for me personally, very important GitHub action workflows that just kind of die a painful death because of timeout issues in the last month. So sometimes you're stuck with that if you're in an enterprise environment that relies on GitHub, but if you're in a personal project,
you do have choices to make. So GitLab is definitely one of those choices. Mike, real quick, have you done much with GitLab before? I've had a couple clients who are on GitLab and really only used it for typical Git type of commands. Haven't really used it for CICD the way Nicola demonstrates in this blog post, but I found it pretty analogous to what GitHub offers. Yes. I feel the same way. And now for you out there that are hearing about GitLab for the first time or maybe you've known about it but you didn't know about the CICD pipeline,
there are a lot of similarities. There are a couple differences, but because we have Nikola's great post here, we can highlight it in a real practical example of publishing portal documents. So what you need to set up with is that first of all, GitLab is free for, you know, personal use for open source projects. They do have, enterprise editions that your enterprise might use, but you could sign up for an account free of charge. Trust me, they're not sponsoring this show. That would be another story, but we're doing a side of our pocket and that's another story. But once you have an account on GitLab,
you would be able to create a repository very similar to what you would do in GitHub and be able to connect to that to your local environment, much like you would with GitHub. So that part is fairly straightforward, but then for the motivating example here, we do have a Quartal document, very straight to the point analysis of the Palmer Penguins dataset that creates a visualization that will be outputted directly into the report. And so you can run that all locally like you would usual with cordo installed on your system.
Here is one tweak that you may not do if you just have a single document that I actually agree with is a good tweak to make no matter if you're going to GitHub for CICD or not. You can create what's called a Quartal project, and the way this is done is you create a special file that Quartal understands called Quartal. Yml, a YAML file, and it can have literally, like in this example, just a couple lines. One is the project literal grouping, which is project, and then within that, you can have a setting
called output dir. And normally when, Corto publishes the site file or the files for your document, it usually does a folder called underscore site when you do a project. She actually recommends changing this to public. And the reason for that is that GitLab treats these public directories in your repository as a very special area that it will serve your website from.
So that is one quick tweak you can make, but again, you could add these project files to do all sorts of additional settings. And if you've ever done a website with Portal, you definitely have used this file, as Mike and I have done in the past with Rashani and production training websites back at POSICONF years past. So once you have that ready to go and you got your report compiled, you can commit that to your repo, and as long as that public directory is in your repo, guess what? You can now go in your,
GitLab settings and you can get a website already deployed. Now there's one little catch though, you do need something to tell GitLab to deploy it. In GitHub you might do the pages setting and you can configure what directory it serves and what branch it serves. With GitLab, you're doing that through another YAML file that does tie in with their CICD pipeline,
and the syntax for this is .gitlab ci. Yml. And the example here, which is again where you've done the rendering yourself and you just want GitLab to publish it, it's very straightforward. You got a pages block and within that you got a few settings. One of them is called stage and you put deploy here because you want this to be executed at the literal deployment stage of your pipeline. You give it a script argument,
which in this case is just an echo statement because you're not actually rendering anything, it's just an informative message to publish to that public folder. And then you define artifacts, which will have a paths field. This is where you put that public directory that again, GitLab is going to treat special as a website content area. And then you can have the only setting which dictates which branches are going to be triggered,
which branches will trigger the CICD pipeline, and in this case, it's the main branch. Once you have that committed to your repo, you could even do that file creation in GitLab itself if you like, you'll be ready to go. One thing you will notice, and I've actually experienced this with Netlify as well, you will have a somewhat randomish name for your URL of the site. And she has a screen grab here where it's got this like deploying, Cordo, git lab demo, and then a random number, dot gitlab.io.
Rolls right off the tongue, right? No, it doesn't. But the nice thing is that you can change that. There are settings in your, repos dashboard settings where you can configure the page, the page URL. You can also, interesting enough, configure how it's accessed. Default is everyone in the public domain. You could have a project in GitLab and only make this visible to project members, And that's also free of charge. That's a nice little feature if you need to secure this with project team
on the host of the GitLab, you know, interface. So that's all good. Now, what I do in daily practice, I think that's good for one off, so you might publish once or twice a while. I like to have an action in GitHub do the rendering for me. I like to have, in that case, I'd run the source, I'd look at it locally, but then I push it to the repository online, and then it does the rendering on its own in its own CICD interface.
You've got a couple ways to do that here. One is if you want to take advantage of Quartal's feature, the freeze computations, which will that's a setting you can do in your YAML, the Quartal doc, and it will create for you a underscore freeze directory. Then in the case of a plot image generation, you'll have literally the image of the plot saved in there. So if you end up doing that and you want the CICD to take advantage of that, you do have to augment that
GitLab CI YAML file a bit more because now you're towing into the line of tapping into a container image to help you with some of the rest of that processing. So I won't read the full example here, but the key part is that you can define the image, and if you're familiar with Docker, you'll feel right at home with this, the container image that the CICD pipeline will use. And in this case, we want the Quarto image for this particular flow because the images by default with GitLab
will not have Quarto installed because it's obviously outside of their standard pipelines. But that already exists in the community, by posit under the portal devorg with the portal image. So instead of then that previous example of the script argument doing that echo call, in this case, you're going do in the script argument, chordal render to run the chordal CLI to render the document. And then there are some other things that you can do for the rules of this,
such as if you're committing to the main branch, but that is the tweak you'll want to make if you do the freezing of the computation. But once again, there is more you can do here, and that is you want to actually run our code in the portal doc when you are pushing this to the repository. So last but sorry not least, this is the flow that I typically do,
and that is that you have, again, the CICD service actually do the R code rendering. So in that case, we're gonna change the image up a little bit because now we don't just need quartal. We need R as well, And that is where we are going to do the rocker image, which we talk about many times on this show. The rocker image, and in this case, they have special
rocker organization for Docker, I should say. They have sub images that are tailored to different purposes. And Nicole, in her example, is using the verse image, which has much of the tidyverse already installed for you, you don't have to install additional packages. You could augment this with RM if you want to do more custom, package installation. You would have to then figure out in the script section what you want to do, but in fact, there is an example of that here.
So in this verse image, unlike the quarto image, we have to install quarto ourselves. So there is a handy argument or setting in the YAML called beforescript. This is where you can run arbitrary commands in the CICD image before it runs what you actually want to do. So in this case, Nikola has examples to install Quartle and install the Palmer Penguins package, because that's not by default in the first image. So once you know to do that, then it's pretty straightforward.
Then your script argument is still the same as the previous example. It's, rscript render, I mean, chordal render, should say, and then everything else is basically the same, but you can add a couple additional nice things here and have a cache of the package installation so that if you run this again, like say the next day or even the next hour, it won't reinstall the packages again in a fresh CICD session.
It'll just take it right back. So that is a nice thing. So with that pipeline in place, now you have everything you need to do the chordal rendering three different ways, with just the output already there in the public folder, or you let the CICD process take over with A, the computations being frozen, or B, the full rendering with R code compiled at runtime.
Now there are some important caveats to consider if you're new to this. I know this from experience. When you're doing any custom images in CICD that are based on Docker, you know, type of images, might, these are running Linux under the hood. So some of these R packages might require system dependencies, cough cough XML2. Don't ask me why I know that, but you will need those from time to time. And also if you're installing packages from GitHub that are not on CRAN,
you might have to add an environment access token from GitHub into your GitLab repo settings as an environment variable. Much like how in GitHub Actions, you might add an arbitrary environment variable to some API service if your GitHub action needs it. Well, GitLab can't automatically install packages from GitHub without a token from your behalf. Unlike in GitHub, if you're using actions, it knows who you are because it's your repo in GitHub,
so you don't need to supply that environment variable. But here you do. But, yeah, Nikola has the full example of this on a GitLab repo, to be appropriate here. So I think this is a very welcome alternative in spite of recent times with GitHub's, you know, somewhat issues with their service quality. Choice is good and GitLab is a very viable choice here. Definitely. I really appreciate Nicola's rundown here of how to use GitLab
for the CICD pages deployment. You know, we have functions from the uses package and the dev tools package, I think, or or maybe even package down that do this for us pretty much automatically with GitHub pages. But I'm sure some users would appreciate a similar function for GitLab and Nicole has laid it out perfectly for here right now, perfectly here for us. So you also mentioned Nicole's recommendation to change the deployment folder to public for GitLab CICD pipelines. And there is a little call out in the blog post as well recommending
for those using GitHub to change your output directory to docs instead of underscore site. This would be a good thing for me to check across all my repositories after this, recording is finished. You and me both. Yes. Yep. So I always try, like you, Eric, to let GitHub actions do all the site rendering for me and create those, you know, 100 plus HTML or JavaScript files. I don't want those on my local machine if I can help it. And obviously, that means employing,
you know, GitHub actions or GitLab CICD, which brings, as you mentioned, sort of another set of tools because those machines are are not your machine. So troubleshooting them can be a little bit tricky. They're probably running an operating system that's different from the one that that you're running. As you mentioned, most of the time, they're they're running Linux. So I can't, you know, kind of promote enough books like data science from the command line, DevOps from DevOps for data science. I think the first one was written by Yaron
Yanson, if I have that correct, data science from the command line. We'll double check. In DevOps for data science, I'm pretty sure was written by Alex Gold. But they're Yes. Wonderful book, by the way. I'll be looking at the show notes. Yeah. Both of Super useful resources here in terms of understanding your CICD YAML file on the command line or or Dockerish language that you'll see in the GitLab CI dot YAML file. And you also mentioned, you know, figuring out your system dependencies that can be tricky in a GitLab or GitHub CICD pipeline for the same reason. It it's not your machine and a lot of times in order to troubleshoot it, you actually have to run it first, which can be a pain to to kick off a CICD pipeline and then wait for it to error and then try to debug from there.
But a cool tip that I have is the pack package can install all of the system dependencies necessary for your project programmatically. So it can discover them and install those system dependencies that your R packages depend on. So really useful there and I can't thank Nicole enough for putting this together for the GitLab users of the world. Yeah, and I know that's increasing at pretty decent rate these days. And
I do think there's a lot of things you can do with CICD and the fact that most of them have the same underpinnings. You might have a couple syntax differences here and there in the YAMLs that you've built in here, but you will see very consistent type of paradigms from GitHub to GitLab, even some of the Git like repository, you know, providers that you can self host like, Forgeo or GitTia.
Yeah, they're all, GitTia, I should say, They all offer some CICD stuff. Now, of course, with GitLab and GitHub, they're doing the hosting for you. So that is that's hard to, you know, it's hard to, beat that kind of, that kind of arrangement. But again, if you master these kinds of skills in more than one provider, you'll be set up if you have to pivot to other things in the future. And so GitLab will be a good way to learn that going forward. Absolutely. And I think the fundamental concepts extend to just the idea of making sure that the code that you run on your own laptop works someplace else.
Exactly. Because you don't want to be the victim of it worked on my machine. And up next in our highlights today, as usual, there are there's not just choice in what we're just talking about with the, you know, CICD providers,
of course, have choice in our data science languages as well. And in the world of AI and LLMs helping us out with our cogeneration, you are having a bit of an easier time maybe to pivot back and forth as you need. Now, with that said, most of you listening, and I'm sure my cohost here as well, know where my bias is. I like the way R thinks, if I want to call it that. I feel more comfortable with that, and when I do coding in other languages, it's hard to break old habits.
But I am not alone here because our next highlight here is from the curator himself of this issue, Jonathan Carroll, whose experience is the same thing as well as he looks at different ways to solve solutions from the R side, but then also what that might look like on the Python side. And John is no stranger, as you well know in listening to the show, and exploring different languages, some of them definitely a lot more on the niche side,
but yet very enlightening to how they do functional programming and other constructs. But in today's world, the lines that we see between R and Python have especially been starting to be blurred a bit. Mike, you know this very well from your talk at last year's POSICONF. There are a lot of interesting synergies here in the world of data processing and even table generation that you can feel comfortable going back and forth. Even the framework we talked about before, Quartle, works just as well to intermingle both R and Python code
in a report if you would like. So there are times that John says in this post that he needs to use Python directly if there isn't like a nice R equivalent package to wrap like an API or some other, you know, niche processing because Python is first and foremost a generalist kind of programming language. It was never built solely for data science at the outset, albeit with the machine learning, you know, explosion, it definitely got a leg up on that side of it. But there are times where
he sees that a pattern he does in R is just different in Python, Not to fro shade or anything, but the example that we have here starts with one of the family of the apply functions, the s apply function to be exact. In R, it is very convenient to basically treat that as a vectorized kind of operation. When you supply a vector, then a custom function, in this case, it's,
you know, the vector and numbers to the squared operator, and you get, if you have a vector of like two, three, four, five, you get the vector back of four, nine, sixteen, twenty five. Very straightforward. Now in Python, not quite like that. You have to turn to a map function and then supply a lambda inside that, is just another syntax or anonymous function, and then you will have to, in order to get the values out, because you get like an iterator object out of that,
you have to wrap that in a list and then you'll be able to get a vector out. And there are other ways you can do this as well, but that's already a different idiom as John puts in his post here. But that's sort of base stuff, right? It gets even more different when you sometimes have a package, but there may be a different approach. And in R, there is a handy built in function called table, that if you have a vector of observations,
say letters in this case, and you want to tabulate how frequent the letters come up, you can just get that quickly of a table function and it is again vectorized to know that right way but then in python it looks a little different you've got to import the counter function from the collections library and then you have to, you can do this sorted, feed in the list of the letters,
and then tack the dot items at the end to then get this kind of list of key value pairs for each letter, it shows how many times it occurred. If you're in the world of Python, you probably don't think anything different about that. That's just the way you work. Yeah, as an R user, that looks really different here. So, so there may be times where you can, you want to take, you can take the plunge a bit, but maybe just sometimes you'd like to make it look more like R.
One way you can do that is literally inside Python, call R itself. There are handy packages that do this called R, I think it's a project or a package called R dash functions that let you wrap an R script that you supply in your Python session and kind of invoke it in that way. So yeah, that can work, and that could be great for a little bit, you know,
smaller functions, let's say. It may end up not scaling as well when you have a lot going on here. He's got more examples of how you might do this with like the witch function and things like that, but, and just how far can you go with this? Well, you can go pretty far here, and in fact, one way, as he's looking at this and looking at other examples, like in the, in R, there's the nchar function to look at the number of characters in a string,
and it's vectorized by default. Well, Python, like the len function, is not vectorized by default and expects a single value, so you have to iterate over a list again. So you can kind of trick it a little bit like he does here, where if he just wants to change a regular function like len into a vectorized version, you can most certainly do that. You just have to build it yourself. And in this case, he does that with a makevec function
that defines this wrapper and, you know, it works. Then the other inspiration for this whole post to begin with is sometimes things get really different in the R world versus the Python world as in a social media post on Mastodon, Elio Campatelli had a bit of a rant you might say about what it's like in python to just list the files in a directory,
and it was a callback to what claus wilk had written that we may have covered in either earlier this year or last year, that in his mind, Python is not the best language for data science. Again, hot take, sure, but I can see sometimes where they're coming from because it's not easy to translate some of these concepts from R to Python to figure out just what we can do here. Well, there is a lot of interesting things you can do, though, is that you could again with the help of lms
write these idioms that are wrapping existing python functions into a way that the that an r user that's using python would be, you know, would be easy to do or easy to follow. So if you do this a lot and you have these, maybe you have more than one of these idioms in place, these customizations, is that, you know, maybe maybe it's best to wrap this in a actual package.
How hard could it be? Well, writing a Python package is a bit different, Mike, but it looks like John here wanted to have a crack at this with the idioms that he wrote here. So why don't you take us through how John accomplished this here? Yeah, after he developed several of those art style functions and the decorator approach, it's very interesting to handle The vectorization in Python, you know, he goes on to describe the process of wrapping these tools into his first ever Python package that he calls our funds, F U N S.
And his creation and release of the package kind of involved several different steps and and considerations. First, development and testing. You know, Jonathan leveraged Claude to implement a number of base R functions and and generate associated tests to ensure the Python implementations accurately mirrored ours behavior used a pie test adapter to run the same tests in our via our pie two, which I think is kind of the opposite of reticulate if I'm not mistaken to kind of go the other way.
Realigning things like zero based versus one based indexing for comparison. Man, that's a huge difference between the languages. I forget about sometimes. And then in terms of of documentation, we know that R has had phenomenal package documentation tooling around the package down site for a long time. A lot of strides being made in Python recently, but still a few different kind of desperate options out there. Jonathan chose QuartoDoc, which is kinda similar to ours package down.
And he noted that in order to get it to work, he had to actually downgrade a specific Python dependency. So maybe a little tip out there for anybody trying to do something similar. And then in terms of the release process and and how it works Python as compared to to the R ecosystem in crayon, he explored that ecosystem and utilize the PyPI test server to first verify that the package appeared before pushing it to the production server. So the package is now available for installation for anyone. If you wanna go with the PIP method, you can just do PIP install our funds.
Obviously, you can do the same with UV. I think these days which is kind of the PIP replacement of choice from what I hear out there and the package, you know, contains functions for string manipulation such as Nchar, number of characters, paste, grep, sub STR, substring, mathematic functions like which, cumulative sum, unique, mean, standard deviation, SD, file handling like list files, checking if a file exists, file underscore exists, and base name to get the name of the file and get rid of any sub directories or the rest of the path to that file.
The functional programming he mentioned like L apply, S apply, and utility inspection tooling like head, tail. And he also introduced a Vec class to wrap binary operators and list comprehensions, which allows, as you mentioned, Eric, us to leverage that vectorization during the comparisons that he ran. Provides a few caveats, I think at the end of the blog post. He doesn't recommend using this package in a production environment
because he prioritized r like behavior over performance optimization and acknowledge that using these abstractions might confuse non r colleagues who are probably more accustomed to the standard Python idioms that I'm sure they use day in and day out. Sort of my last takeaway here is, you know, maybe Bruno Rodriguez, think is the one who's coming up with a new language called T, if I'm not mistaken, that supposedly allows us to stitch together pipelines containing both R and Python code in the the same language
and avoid the need potentially for what Jonathan had to do here and I run into all sorts of situations. A lot of times, it's exactly as Jonathan mentioned with some SDK that is implemented in Python to wrap an API that I could create a new R package for because one doesn't exist or it's been archived on crayon because it's ten years old and hasn't been touched. But it'd be interesting to see maybe if tea could solve some of those issues. Funny you mentioned that Mike, and actually Jonathan himself was a fan of this. We did talk to Bruno in a recent Our Pharma Hangout session, and yes, I have the recording out there along with my experience of converting,
in this case, an R based pipeline with targets into T. But yes, Bruno did very much pitch the idea of this workflow first language has no issue thanks to the power of NICS to have both R and Python and heck even Julia, you know, runtimes to do various steps in a pipeline. So yeah, I think TEA could be a very interesting fit in a lot of these multi language data science pipelines. So yeah, that is very much something I'm taking a look at. It's still early days, as Bruno
definitely acknowledges in that Hangout session, But I'm intrigued enough to try that for any multi language pipeline I have in the future, especially as we start to scale up to more of these with the advent of LMs and having to hop back and forth. But it is great to see just kind of what John's thought process was to take the best of the R way of thinking, applying it on the Python side. But now something that probably I know would have taken me at least a couple months to do, and that's being generous because I'm not a Python expert,
turning that around into a session of, I don't know, maybe a few nights worth that John did with Quad, it's opening up a lot of doors. And then like you said, with T, we can bring this all together really seamlessly. And I think it's a new world out there, but it's great to see just what that process looks like that we can take advantage of in our future pipelines.
All right, and up next in our highlights that close us out. And Mike and I can tell you many times, we are a big fan of building tests for our packages and our apps, because you don't want to be the victim of, well, it worked when I did that recent change, but now in this new change, you don't want to find out that bug exists from your end user. You want to protect yourself with better tests. Now there are some cases where you think you are protecting yourself and you probably are for 90% of cases,
but there might be some edge cases that you might miss. And this last highlight here, is going to help you with a very clever way to hone in on those edge cases in a very targeted fashion. And this blog post comes to us from Jacob Soboewski and he talks about an update to his package Mutest, Mutest version 0.2, which comes out of the box with more of these mutators, which we'll get to, better reporting and parallel execution.
So let's take a step back here and talk about what exactly is mutation testing. There's some great examples here. In fact, there is a little actually mathematical art here that you can define what's called a mutation score, where if you take a deliberate change to say the logic in your test, and then you look at the proportion of those tests that failed after that mutation compared to how many of those you ended up doing,
you get what's called a mutation score out of that, and that's where if you get like a bad percentage here of zero, you might think that's good, right? Well, they pass no matter what, and it means that you may be missing something. But if you find that you get a threshold even close to one hundred percent, then realize, well, maybe they need to look at your tests a little bit because it looks like one little change can change everything. Now that may seem abstract. Let's talk about why that actually matters here.
His example here is a simple function in R called is adult, which is checking if the age that's supplied there is greater than or equal to 18, which at least here in The U. S. Is one of those for various legal reasons as a way you might consider as an adult. And you may have tests that verify this, that it's true when it's supposed to be true and false otherwise, and you get, say if you feed 25 or 10, they're going to correctly identify as a true or false respectively.
Now here's where it gets fun. What if you mutate that test a little bit? You change that greater than an equal sign to just a greater than sign, so age greater than 18. Now maybe that was an accident in your code as you're updating things and you get that to production, and then somebody uses that app or that package that's wrapping this, feed it an age of 18 because they just turned 18, and whoops, they're not considered an adult. Well, that's where you wouldn't know that until it was already the change was already made.
That's where mutest comes in, is that you can have a plan with mutest plan, that's a function, and feed it in a set of common mutators, and in this case, there's a helper function called comparison operators, and that will look at arbitrary switching of the operators inside any of your conditionals in your functions. And sure enough, this age function would not survive after this because it would look at this edge case and realize that the 18 is now not flagged as an adult
appropriately. This is also important for another reason, and I actually have gone through this. I have recently, in the last two months, written unit tests with the generous help of LMs along the way because I was very direct with my prompt on here are the functions, here are their purposes, here are their arguments, help me build a unit test. And on the first pass, I won't lie, it didn't get it quite right the first time, but after some iteration, I felt pretty comfortable with it. Well, it might be easy to take a lot for granted because these tests
may not be prepared for these edge cases that might come their way. So this is where in the age of LMs, and Jacob, you know, posses this in the post here, this is an area that needs attention. You need that extra review, that extra validation, and mutest can help with this. So at a high level, one of the new features here, get new mutators available. Now on top of that comparison one,
you might do increments of an index, you might change negations if you're doing like not something, and you can do other replacing return values, things that, again, may not make sense a lot, but you'd be surprised at what you do when your code is updated, that some things get changed and you least expect it, whether you're collaborating with somebody, whether a person or an agent helping you with it. There are lots of interesting things here, and the other thing is that the mutators are now parameterized,
so you can, you know, make sure that you can build in exactly what you want to replace and with what if you want to define your own mutator outside of what the helper functions do. You get some new ways of reporting this as well, which it looks like kind of inspired by TestTad as well, along with the score of your mutator overall, and also parallel execution using mirai, another package that we think of highway here on this show.
So you can install this on CRAN, the updated versions on CRAN, and yeah, Mike, I probably need to look at this for my next, testing review. This looks pretty powerful here. Likewise, it's a concept that I hadn't really thought of before. Obviously, I think we all try to write tests that are super specific, but checking that our tests are specific enough is, you know, not something that I've really dived into before and mute test can be a phenomenal tool for doing so. So, I'm excited to check out this o point two. Oh release and some of the improvements that have been made to the package and start using it in my workflows.
Yep. I am putting this in my package library for my app that I'll do a version two of this year because I think this will be extremely important, not just for apps, I think for packages, can benefit from this just as much if it's a heavily used package by your app or by your other users. So this looks really, really promising. What else is promising? Well, it's always promising, but it's also legit is the great content that we get every week at Our Weekly. And Jonathan's curated another fantastic
issue here on top of the highlights we mentioned here. Lots of other great posts here from other blogs, package updates, everything in between. You've got a lot to choose from here and it's all available to you rweeker.org. So we don't have time for the additional fines here, but I will mention, like we were talking about earlier, we will have links in the show notes where we talked about outside these highlights, like those great books that Mike mentioned,
the tea language and the hangout that we just talked about with Bruno. I think it's fascinating stuff to look at when you get some spare time. We also love to hear from you about what you're up to in your data science adventures with either of things you found at our weekly or beyond. So we'd love to hear about it. You can get in touch with us, I should say, in various ways. You can get in touch with us on social media. I am on blue sky with rpodcastbsky. Social.
I am also on Mastodon where I'm r podcast at podcastindex.social. And last but not least, I am on LinkedIn. Search my name and you'll find me causing stuff going on over there. Mike, where can they find you? You can find me on Blue Sky at Mike-thomas@bsky.social or on LinkedIn if you search catch brook analytics, k e t c h b r o o k, you can see what I'm up to. Very good. I know you've been traveling recently. I've been traveling recently, so we got it's good to hopefully get some downtime a bit, but yeah, we're on this new recording schedule and yeah, we're always
eager to hear from you like always. Well, anyway, let's wrap up here. This is gonna close out episode two twenty eight of our weekly highlights. Easy for me to say. Thank you so much for joining us, and we will see you have another episode of our weekly next week.
Our takes on the increasing removal of friction in good and not-so-good ways thanks to AI, a visual tour of hot air balloon accident data, and a case study of novel image recognition with the rplatipus package. Episode...
The flow of both data and analytical jobs just got smoother with mizu, opening the door for multiple agent harnesses in Positron, and an optimal statistical model tailored to complex experimental designs with a friendly...
What happens when that online data set isn't so easy to download anymore? We learn of two packages to ease the pain of obtaining these files and then some. Plus a visit to the visualization corner with a handy way to...
The celebration of rOpenSci's 15-year anniversary continues with the community sharing their perspectives, and a fun Shiny app that could be quite useful during celebrations on a weekend or the holidays. If you ever...
We learn about the variety of ways you can contribute back to the core of R, a roundup of the excellent choices available for package and environment reproducibility, and an amazing collection of Shiny applications and...