generateRandomIDs: Generate random participant IDs

View source: R/experiments.R

generateRandomIDsR Documentation

Generate random participant IDs

Description

This function generates a set of random IDs for use in experiments where participant anonymity is important. The IDs are not generated with R's random number generator, but uses openssl.

Usage

generateRandomIDs(
  checkFile = "randomIDs.csv",
  IDlength = 3,
  number = 100,
  addToFile = checkFile
)

Arguments

checkFile

CSV file with previous IDs that should not be duplicated

IDlength

Number character pairs to use for IDs (3 is 6 characters)

number

How many IDs to add to the existing list.

addToFile

What CSV file to write the IDs to.

Details

The function does not yet check if it is possible to generate as many unique IDs as requested with the given length, so be careful not to start an endless loop. (With 1 bit, you only get 256 combinations in total.)

When opened in spreadsheet software, some IDs could be interpreted as a type of number, but when read in with most kinds of software, they work OK.

Examples

generateRandomIDs()

thartbm/handlocs documentation built on Feb. 18, 2025, 10:53 p.m.