Without leaving the tidyverse, just extract the numbers with readr::parse_number(), then use order() on the string:
Treatment <- c("Control", "Asprin 10mg/day", "Asprin 50mg/day", "Asprin 100mg/day", "Acetomycin 100mg/day" "Acetomycin 1000mg/day")
Treatment[order(readr::parse_number(Treatment))]
02.10.2025 08:37 โ ๐ 2 ๐ 0 ๐ฌ 0 ๐ 0
ggplot2 and now plumber2! What a year! ๐
24.09.2025 12:53 โ ๐ 1 ๐ 0 ๐ฌ 0 ๐ 0
It is like saying that I know how to fix a faucet because I can call a plumber
22.09.2025 07:51 โ ๐ 2 ๐ 0 ๐ฌ 0 ๐ 0
Another instance of the Norway problem!
22.09.2025 07:23 โ ๐ 1 ๐ 0 ๐ฌ 1 ๐ 0
Most companies donโt need deep learning. They need clean joins, honest metrics, and interpretable results.
Startups often chase GPU clusters before fixing their CSVs.
#DataScience #MachineLearning #AI #RStats
17.09.2025 22:17 โ ๐ 14 ๐ 6 ๐ฌ 0 ๐ 0
TIL! I've always used {tibble} enframe()/deframe()
08.09.2025 08:16 โ ๐ 3 ๐ 0 ๐ฌ 0 ๐ 0
Microsoft Powertoys: calculator, fuzzy file search, OCR text extractor, advanced paste and SO MUCH MORE with a single keystroke from anywhere! ๐
05.09.2025 07:00 โ ๐ 0 ๐ 0 ๐ฌ 1 ๐ 0
And then it's up to you to reflow anything since it's too difficult for them to open a text file. Not to mention when they require Track Changes.
27.08.2025 07:30 โ ๐ 0 ๐ 0 ๐ฌ 0 ๐ 0
Pairs up nicely with the Norway problem!
26.08.2025 16:19 โ ๐ 0 ๐ 0 ๐ฌ 0 ๐ 0
In princilple you can play around with the `cue` to avoid some of the invalidation causes. But I'm guilty too, I like to dump intermediate/cleaned results to csv and rds, even if I completely trust my pipeline. "You never know".
26.08.2025 07:28 โ ๐ 0 ๐ 0 ๐ฌ 1 ๐ 0
One solution: fix the function environment of \() by making one on the spot. Modify the loop contents with:
list_vec[[i]] <- local({
i <- i
\() paste("vec is:", i)
})
Or manually::
e <- new.env()
e$i <- i
environment(list_vec[[i]]) <- e
list_vec[[i]] <- \() paste("vec is:", i)
22.08.2025 09:32 โ ๐ 1 ๐ 0 ๐ฌ 0 ๐ 0
Proof:
rlang::fn_env(list_vec[[1]]) # <environment: R_GlobalEnv>
rlang::fn_env(list_vec[[2]]) # <environment: R_GlobalEnv>
list_vec[[1]]() # "bar"
list_vec[[2]]() # "bar"
i <- "other"
list_vec[[1]]() # "other"
22.08.2025 07:26 โ ๐ 1 ๐ 0 ๐ฌ 1 ๐ 0
The functional wants to access the name `i` when it is called later, so it looks up in the function environment. Since each iteration is executed inside R_GlobalEnv, the value of `i` is not fixed.
22.08.2025 07:25 โ ๐ 1 ๐ 0 ๐ฌ 1 ๐ 0
No it's because of the function environment of the \() functional (R_GlobalEnv), which is associated during its creation (each iteration of the loop).
22.08.2025 07:25 โ ๐ 2 ๐ 0 ๐ฌ 1 ๐ 0
More than 10 years of R, and this still caught me off guard... #rstats
vec <- c("foo", "bar")
list_vec <- list()
for (i in vec) {
list_vec[[i]] <- \() paste("vec is:", i)
}
list_vec[[1]]() # "vec is: bar"
list_vec[[2]]() # "vec is: bar"
21.08.2025 22:25 โ ๐ 7 ๐ 1 ๐ฌ 3 ๐ 0
For VSCode I liked vscode-data-preview when it worked!
30.07.2025 23:05 โ ๐ 1 ๐ 0 ๐ฌ 0 ๐ 0
Amazing! I always end up doing something that could benefit from this (a big qmd with wrangling and literate exploration โ for me โ and a qmd with the selected results)
27.07.2025 14:28 โ ๐ 2 ๐ 0 ๐ฌ 0 ๐ 0
Pasta is lunch/dinner soup
23.07.2025 15:06 โ ๐ 0 ๐ 0 ๐ฌ 0 ๐ 0
And some are still against NSE!
23.07.2025 08:25 โ ๐ 1 ๐ 1 ๐ฌ 2 ๐ 0
VSCode is a much more pleasant coding experience (better multi-cursors, multi-file regex search, minimap, goto anything), and the current Copilot works pretty well for oneliners! I just miss R-specific workflows (debugging, Rmd/Qmd auto-loaded params, tests) but they're slowly coming
22.07.2025 20:19 โ ๐ 2 ๐ 0 ๐ฌ 0 ๐ 0
Why the slots and the quoted variables?
06.07.2025 21:16 โ ๐ 1 ๐ 0 ๐ฌ 1 ๐ 0
Why not go full {lubridate}?
parse_date_time("May-23", "bd")
28.05.2025 07:15 โ ๐ 1 ๐ 0 ๐ฌ 1 ๐ 0
Blink twice for help
20.05.2025 17:12 โ ๐ 1 ๐ 0 ๐ฌ 1 ๐ 0
It's much easier if you can start from the rocker images! They already have the whole tidyverse preinstalled (until you need a specific version: renv+PPM+pak helps a lot but it's still lots of dependencies)
23.04.2025 09:17 โ ๐ 0 ๐ 0 ๐ฌ 0 ๐ 0
I discovered that too by reading {readr}'s code!
19.04.2025 07:38 โ ๐ 2 ๐ 0 ๐ฌ 0 ๐ 0
They are also never completely true or false โ they work well inside their own (i.e. the observer's) limits. Geocentrism is "true" if you do not care about astronomy!
13.04.2025 21:51 โ ๐ 0 ๐ 0 ๐ฌ 0 ๐ 0
I hope no one is working on {err} (a spell-checker?) ๐คฃ
26.02.2025 07:31 โ ๐ 1 ๐ 0 ๐ฌ 0 ๐ 0
Why use air.toml instead of the .editorconfig?
23.02.2025 09:37 โ ๐ 1 ๐ 0 ๐ฌ 0 ๐ 0
I routinely copy things from dplyr: there are pages for specific concepts (non-functions) with inline references across the whole package. Super useful to document bigger packages (with data dictionaries, etc.)! Also, reactable and gt for the huge list of examples!
05.02.2025 15:19 โ ๐ 1 ๐ 0 ๐ฌ 0 ๐ 0
Anthropologist - Bayesian modeling - science reform - cat and cooking content too - Director @ MPI for evolutionary anthropology https://www.eva.mpg.de/ecology/staff/richard-mcelreath/
Professor in computational Bayesian modeling at Aalto University, Finland. Bayesian Data Analysis 3rd ed, Regression and Other Stories, and Active Statistics co-author. #mcmc_stan and #arviz developer.
Web page https://users.aalto.fi/~ave/
Principal Engineer at Posit (fka RStudio), technical lead at quarto.org
Learning Brazilian Choro and the 7-string guitar
The central mission of the R Consortium is to support to the R Foundation and key organizations developing, maintaining, distributing R software through the identification, development and implementation of infrastructure projects.
Unofficial CRAN updates bot maintained by @chriskenny.bsky.social using R package bskyr https://christophertkenny.com/bskyr/
Code hacker, number cruncher, #rstats user, board gamer, road racer, plant eater, bass slapper.
I like big bikes and I cannot lie. #cargobike
Coming to you from AUS / BNE.
https://milesmcbain.com
Journalist (social topics/sports politics/doping). CEO http://EyeOpening.Media, documentaries for ARD German TV + broadcasters abroad, http://hajoseppelt.de
The image that I run from
Only seems to follow me
Building tools for R users, these days mostly in Rust ๐ฆ
https://blog.davisvaughan.com
https://github.com/DavisVaughan
https://masalmon.eu/
๐งฐ #Rstats / research software engineer.
๐๏ธ Blogger.
๐ฆ Software review editor for @ropensci.
๐ #RLadies.
๐ PhD in statistics.
๐ Nancy, France (let's say this emoji is a bergamot orange).
he/him - writing statistical software at Posit, PBC (nรฉe RStudio)๐ฅ
simonpcouch.com, @simonpcouch elsewhere
Software Engineer at Posit, PBC
https://fosstodon.org/@gaborcsardi
https://github.com/gaborcsardi
Here mostly for R, Python, stats, Quarto, and web dev stuff
Demographics | Geospatial | Data Science | Open Source
Systems Eng Prof @ GWU ๐ฆ | Director, Data Analytics MS Program | EVs ๐๐ | Low Carbon Tech | Choice Modeling | Survey Research | China | US-China Policy | #rstats | #reproducibility | #opensource | Father | opinions own