Open utterances-bot opened 2 years ago
Hi Tristan,
thank you for this interesting post.
As an addition I would like to point to the ids
package for creating random ids:
ids::random_id(n = 1, bytes = 3)
# "6a118f"
An alternative to the direct sprintf
-call could be using formatC
a <- sprintf(paste0("p", "%0", 3, "d"), 1:3)
b <- paste0("p", formatC(1:3, width = 3, flag = "0"))
all.equal(a, b)
Best regards
An alternative to the direct
sprintf
-call could be usingformatC
Thanks for the example. I don't think I have used formatC()
before.
A one-liner for generating random participant IDs - Higher Order Functions
Find a match() in your base R library
https://tjmahr.github.io/one-liner-to-generate-ids/