The code style - and in particular the *comments - indicate most of the code was written by AI. My apologies if you are not trying to hide this fact, but it seems like common decency to label that you're heavily using AI?
*Comments like this: "# Anonymous function"
Is there a threshold? I assume spell checkers, linters and formatters are fair game. The other extreme is full-on ai slop. Where do we as a society should start to feel the need to police this (better)?
Edit: just found this disclaimer in the article:
> I’ll show the generating R code, with a liberal sprinking of comments so it’s hopefully not too inscrutable.
Doesn't come out the gate and say who wrote the comments but ostensibly OP is a new grad / junior, the commenting style is on-brand.