Learn R Programming

faux (version 1.2.1)

make_id: Make ID

Description

Make IDs with fixed length and a prefix (e.g., S001, S002, ..., S100).

Usage

make_id(n = 100, prefix = "S", digits = 0, suffix = "")

Value

a vector of IDs

Arguments

n

the number of IDs to generate (or a vector of numbers)

prefix

the prefix to the number (default "S")

digits

the number of digits to use for the numeric part. Only used if this is larger than the largest number of digits in n.

suffix

the suffix to the number (default "")

Examples

Run this code

make_id(20, "SUBJECT_")
make_id(10:30, digits = 3)

Run the code above in your browser using DataLab