Sign in

Måns Thulin

@mansthulin.bsky.social
279 followers 105 following 156 posts

I work in statistics and AI. Consultant, teacher, researcher. #Rstats user. Book: modernstatisticswithr.com Homepage: mansthulin.se Co-founder of aireview.se

PostsRepliesMedia
Måns Thulin @mansthulin.bsky.social · 02/10/2026
For self-study, my book www.modernstatisticswithr.com should tick those boxes (but I'm obviously heavily biased here 😀)
modernstatisticswithr.com
Modern Statistics with R
Modern Statistics with R
000
Måns Thulin @mansthulin.bsky.social · 30/09/2026
The answer will depend on what you're planning to use R for. Visualisation? Data wrangling? More advanced statistics? Machine learning? Developing Shiny apps?
111
Måns Thulin @mansthulin.bsky.social · 22/09/2026
It's fine, memories melt() away over time. Don't cast() any shade on yourself!
031
Måns Thulin @mansthulin.bsky.social · 10/09/2026
It's been six months since I wrote about some statistical friction points in {tidymodels} (bootstrap inference and LOOCV). I opened GitHub issues to track them back then, but none have received engagement or comments from the tidymodels team yet. Would still love to see a dialogue on these. #Rstats
040
Måns Thulin @mansthulin.bsky.social · 07/09/2026
Yeah, it's a publishing rights thing. You can email me or DM here if you have suggestions or have found typos. I'm slowly starting to plan additions for the third edition, so suggestions are even more welcome than usual at the moment :)
010
Måns Thulin @mansthulin.bsky.social · 15/06/2026
The native pipe has finally become the default in new RStudio installs! 🥳 #Rstats github.com/rstudio/rstu...
github.com
Use native pipe (`|>`) instead of magrittr pipe (`%>%`) by default? · Issue #14965 · rstudio/rstudio
Native pipe was introduced in R 4.1, which was released in 2021. I understand it was too early to switch the default at the time of the native pipe support was added in RStudio, but maybe it's rath...
0141
Måns Thulin @mansthulin.bsky.social · 05/06/2026
And ivo.table::ivo_table() if you want publication-ready contingency tables.
020
Måns Thulin @mansthulin.bsky.social · 02/06/2026
If you're looking for something R-oriented, Modern Statistics with R might be a good option: www.modernstatisticswithr.com/basicstatist...
modernstatisticswithr.com
3 The cornerstones of statistics | Modern Statistics with R
3 The cornerstones of statistics | Modern Statistics with R
020
Reposted by Måns Thulin
Dr Di Cook @visnut.bsky.social · 11/05/2026
Super excited to get this at my door today! Ursula Laa and my book on exploring high-d data and models is in print! Book website is www.routledge.com/Interactivel... if interested I think my 30% discount code might work for you - msg me. Time to update dicook.github.io/mulgar_book/ too! #rstats
415832
Reposted by Måns Thulin
James Balamuta @coatless.bsky.social · 04/05/2026
A month later, here is what happened to this work. blog.thecoatlessprofessor.com/posts/extrac... #rstats
blog.thecoatlessprofessor.com
Extraction with a Footnote – TheCoatlessProfessor
2249
Måns Thulin @mansthulin.bsky.social · 14/04/2026
Wow!
010
Måns Thulin @mansthulin.bsky.social · 13/04/2026
Which monster drops hex stickers? 😁
000
Måns Thulin @mansthulin.bsky.social · 09/03/2026
Is your working directory and/or your files on OneDrive? Strangely, this can cause these kinds of problems (the solution being storing things on a local drive instead).
110
Måns Thulin @mansthulin.bsky.social · 28/02/2026
No, but I'll check it out. Thanks!
000
Måns Thulin @mansthulin.bsky.social · 28/02/2026
train |> ... |> fit(train) gives my soul a papercut
100
Måns Thulin @mansthulin.bsky.social · 28/02/2026
Thanks, Di. I too am hoping that these issues will be fixed. Until then I'm sticking to caret in my teaching, as it also does a good job of coordinating machine learning software. I'm reluctant to tell students to use the tidymodels ecosystem because of the issues mentioned in my post.
110
Måns Thulin @mansthulin.bsky.social · 28/02/2026
Yeah, I think that's an important difference between tidymodels and ggplot2!
000
Måns Thulin @mansthulin.bsky.social · 27/02/2026
Kind of awkward to have to add data at two different steps. But definitely an improvement on the flow recommended in the documentation!
200
Måns Thulin @mansthulin.bsky.social · 27/02/2026
Absolutely. But in all the examples you mention, you'd start with data. And starting a pipeline with the data is the de facto standard in R. Creating a separate logic for how to pipe things is not very helpful to beginners.
020
Måns Thulin @mansthulin.bsky.social · 27/02/2026
Happy to submit these as issues within the next few days!
010
Måns Thulin @mansthulin.bsky.social · 27/02/2026
Great description! And so it boils down to whether you're willing to accept two different logics for how the pipe works. I maintain that the dual logics create more problems than they solve, but I get that some people like the tidymodels approach.
120
Måns Thulin @mansthulin.bsky.social · 27/02/2026
Some, yes. All ignored unfortunately. I agree that most of these issues could be fixed (which of course is the reason that I wrote this in the first place!)
120
Måns Thulin @mansthulin.bsky.social · 26/02/2026
Glad you liked it!
000
Måns Thulin @mansthulin.bsky.social · 26/02/2026
While we're discussing what we like and dislike in #Rstats, here's why I don't like tidymodels: mansthulin.se/posts/tidymo...
mansthulin.se
Why I don’t use {tidymodels} – Måns Thulin
7427
Reposted by Måns Thulin
Dirk Eddelbuettel @eddelbuettel.com · 25/02/2026
Josh Goldstein emailed me a nice tip for @rdatatable.bsky.social chaining: if we start a chained `data.table` operation inside a set of parens, we are no longer subject to the 'REPL constraint' and can keep each operation on a line. See ALT text. #rstats Now in the pdf at github.com/eddelbuettel...
Diff of a change the 'Getting Started in R - Tinyverse Edition' manuscript with a nice data.table improvement: inside a pair of ( ) we can place each chained operation on its own line improving readability.  

I.e. we have

cw21 <- (  # use '(' to keep ops on separate lines
    cw[Time %in% c(0,21)]          # i: select rows
    [, weight := Weight]           # j: mutate
    [, Group := factor(Group)]
    [, .(Chick,Group,Time,weight)] # j: arrange
    [order(Chick,Time)]            # i: order
    [1:5]                          # i: subset
)
2234
Måns Thulin @mansthulin.bsky.social · 25/02/2026
Well, you shouldn't use Python or MATLAB for statistics. Simple as. 😀
141
Måns Thulin @mansthulin.bsky.social · 25/02/2026
I love the hidden-gem magrittr pipes, but these days I stick with the base pipe. In this case, you can do: mtcars |> with(cor(disp, mpg))
modernstatisticswithr.com
2 The basics | Modern Statistics with R
2 The basics | Modern Statistics with R
151
Reposted by Måns Thulin
R Consortium @rconsortium.bsky.social · 24/02/2026
R/Medicine CFP is open 🩺🧪 Deadline: March 6 - still time! Submit: Talks, Lightning Talks, Demos, Workshops - Using R + Shiny for health, lab, clinical data First-time speaker? Email for feedback: rmedicine.conference@gmail.com rconsortium.github.io/RMedicine_we... #rstats #datascience
R Medicine 2026 - main graphic - Call for Proposal, deadline March 6
184
Måns Thulin @mansthulin.bsky.social · 23/02/2026
I love RStudio, but I'm flabbergasted by the fact that @posit.co still haven't made |> the default for the Ctrl+Shift+C keyboard shortcut, despite their using it in e.g. the tidyverse documentation and R4DS. #Rstats
181
Måns Thulin @mansthulin.bsky.social · 19/02/2026
Thanks, will do!
000
Måns Thulin @mansthulin.bsky.social · 18/02/2026
Looks really nice! Is there an option to print confidence intervals instead of standard errors (the former being more informative)? If you'd be interested in adding bootstrap p-values/CIs as an option, I'd be happy to assist in integrating it with {boot.pval} (mthulin.github.io/boot.pval/ar...)
mthulin.github.io
Bootstrap p-values and confidence intervals for regression models
110
Måns Thulin @mansthulin.bsky.social · 13/02/2026
I've been playing around with {marginaleffects} in some projects lately, and I really like it. Lots of useful stuff in there! If you work with regression models and haven't checked it out already, I strongly recommend that you do so: marginaleffects.com/bonus/get_st... #Rstats #Databs
marginaleffects.com
Quick start – Model to Meaning
1150
Måns Thulin @mansthulin.bsky.social · 02/02/2026
How about penguins |> subset(select = c("island", "bill_len")) |> subset(island == "Biscoe" & bill_len > 55)
020
Måns Thulin @mansthulin.bsky.social · 02/02/2026
I cover both base and the tidyverse in Modern Statistics with R (expect for plotting, where I focus on ggplot2 and only briefly mention base): www.modernstatisticswithr.com
modernstatisticswithr.com
Modern Statistics with R
Modern Statistics with R
020
Måns Thulin @mansthulin.bsky.social · 21/01/2026
Gave the first lecture in my introductory statistics for biologist course yesterday, so this should come in handy. 😀 Thanks for sharing!
120
Reposted by Måns Thulin
Andrew Heiss @andrew.heiss.phd · 09/12/2025
Some closing thoughts for my students this semester on LLMs and learning #rstats datavizf25.classes.andrewheiss.com/news/2025-12...
Will you incorporate LLMs and AI prompting into the course in the future?
No.

Why won’t you incorporate LLMs and AI prompting into the course?
These tools are useful for coding (see this for my personal take on this).

However, they’re only useful if you know what you’re doing first. If you skip the learning-the-process-of-writing-code step and just copy/paste output from ChatGPT, you will not learn. You cannot learn. You cannot improve. You will not understand the code.In that post, it warns that you cannot use it as a beginner:

…to use Databot effectively and safely, you still need the skills of a data scientist: background and domain knowledge, data analysis expertise, and coding ability.

There is no LLM-based shortcut to those skills. You cannot LLM your way into domain knowledge, data analysis expertise, or coding ability.

The only way to gain domain knowledge, data analysis expertise, and coding ability is to struggle. To get errors. To google those errors. To look over the documentation. To copy/paste your own code and adapt it for different purposes. To explore messy datasets. To struggle to clean those datasets. To spend an hour looking for a missing comma.

This isn’t a form of programming hazing, like “I had to walk to school uphill both ways in the snow and now you must too.” It’s the actual process of learning and growing and developing and improving. You’ve gotta struggle.This Tumblr post puts it well (it’s about art specifically, but it applies to coding and data analysis too):

Contrary to popular belief the biggest beginner’s roadblock to art isn’t even technical skill it’s frustration tolerance, especially in the age of social media. It hurts and the frustration is endless but you must build the frustration tolerance equivalent to a roach’s capacity to survive a nuclear explosion. That’s how you build on the technical skill. Throw that “won’t even start because I’m afraid it won’t be perfect” shit out the window. Just do it. Just start. Good luck. (The original post has disappeared, but here’s a reblog.)

It’s hard, but struggling is the only way to learn anything.You might not enjoy code as much as Williams does (or I do), but there’s still value in maintaining codings skills as you improve and learn more. You don’t want your skills to atrophy.

As I discuss here, when I do use LLMs for coding-related tasks, I purposely throw as much friction into the process as possible:

To avoid falling into over-reliance on LLM-assisted code help, I add as much friction into my workflow as possible. I only use GitHub Copilot and Claude in the browser, not through the chat sidebar in Positron or Visual Studio Code. I treat the code it generates like random answers from StackOverflow or blog posts and generally rewrite it completely. I disable the inline LLM-based auto complete in text editors. For routine tasks like generating {roxygen2} documentation scaffolding for functions, I use the {chores} package, which requires a bunch of pointing and clicking to use.

Even though I use Positron, I purposely do not use either Positron Assistant or Databot. I have them disabled.

So in the end, for pedagogical reasons, I don’t foresee me incorporating LLMs into this class. I’m pedagogically opposed to it. I’m facing all sorts of external pressure to do it, but I’m resisting.

You’ve got to learn first.
14336103
Måns Thulin @mansthulin.bsky.social · 09/12/2025
This is so useful. I usually add custom information to the box shown when hovering, using the text geom. An example can be found here: www.modernstatisticswithr.com/eda.html#det... #Rstats #statsky #databs
modernstatisticswithr.com
4 Exploratory data analysis and unsupervised learning | Modern Statistics with R
4 Exploratory data analysis and unsupervised learning | Modern Statistics with R
051
Reposted by Måns Thulin
Nicola Rennie @nrennie.bsky.social · 26/11/2025
One of the things that has been on my to do list for a very long time, is building a gallery of all of the charts I've made across #TidyTuesday, #30DayChartChallenge, #30DayMapChallenge, and other miscellaneous projects 📊 And it's finally here! Link: nrennie.rbind.io/viz-gallery/ #DataViz #RStats
nrennie.rbind.io
Data Visualisation Gallery
Gallery of data visualisations created by Nicola Rennie.
613122
Måns Thulin @mansthulin.bsky.social · 21/11/2025
"The difference between the groups is 1.1-2.6 measured using something that is a bit like the median but not quite the median" 😉
030
Måns Thulin @mansthulin.bsky.social · 21/11/2025
They test different hypotheses though, so the Wilcoxon test isn't a like-for-like replacement for the t-test. A bootstrap t-test is my go-to method for tests about means (using {boot.pval}). It has the added benefit of providing confidence intervals, unlike the Wilcoxon test.
130
Reposted by Måns Thulin
Daniel Gutierrez @ddgutierrez.bsky.social · 20/11/2025
Students often ask: “Is this model good enough?” My reply: “For what?” AUC, precision, F1—none of them matter unless you know what decision you're informing. Always tie metrics to action. #DataScience #MachineLearning #AI #RStats
072
Måns Thulin @mansthulin.bsky.social · 19/11/2025
It's great to use with pipes! Then everything goes from left to right.
010
Måns Thulin @mansthulin.bsky.social · 18/11/2025
Very interesting - thanks for sharing!
010
Måns Thulin @mansthulin.bsky.social · 10/11/2025
I remember seeing a github repo for this a while ago. Might have been this one, but I'm not sure: github.com/AllanCameron...
120
Måns Thulin @mansthulin.bsky.social · 04/11/2025
If you use git a lot, use Python, or need AI assistants: yes. Otherwise: no, stick with RStudio - it's still great at what it does and keeps getting better.
010
Måns Thulin @mansthulin.bsky.social · 25/10/2025
Looks really interesting! I might use this as a case study when I teach statistics for biologist next year.
110
Måns Thulin @mansthulin.bsky.social · 24/10/2025
Thanks Daniel! Very happy to hear it!
000
Måns Thulin @mansthulin.bsky.social · 24/10/2025
It's the variance of the _estimator_ that matters. This is still true if you estimate higher moments like skewness and kurtosis. The variance of those estimators will be related to the sixth and eight moments of the measurements, but it's still a variance.
230
Måns Thulin @mansthulin.bsky.social · 23/10/2025
strsplit("this/is/my/path", "/")[[1]]
120
Reposted by Måns Thulin
Claus Wilke @clauswilke.com · 22/10/2025
We need to have a conversation about random seeds. Don't use 42. blog.genesmindsmachines.com/p/if-your-ra...
blog.genesmindsmachines.com
If your random seed is 42 I will come to your office and set your computer on fire🔥
Figuratively. More likely you'll get a stern talking to.
168935