Join Nostr
2026-06-10 19:15:06 UTC

doctorambient on Nostr: TIL (1) that R has a function called `dput()` that writes a text representation of an ...

TIL (1) that R has a function called `dput()` that writes a text representation of an R object and (2) that a `c()` in an index will effectively flatten a mixture of indices. Hence:

`dput(names(df)[c(1:4, 7)]`

solves the problem of picking out a list of column names from a data frame and turning that into an object ready to insert into code. 🙃

#rlang #r #rstats #datascience #dataanalysis