Generate sequence of "subject id"s

subjid_func(n, prefix = "id", suffix = NULL, sep = "-")

Arguments

n

numeric(1). number of ids to generate. Values will be padded with leading 0s so all resulting ids have equal width

prefix

character(1). Prefix to prepend to the generated numeric ids. Defaults to "id"

suffix

character(1). Suffix to append to generated ids. Defautls to NULL (no suffix).

sep

character(1). String to use as separator when combining prefix, number, and suffix.

Value

sequence from 1 to n, prepended with prefix, and appended with suffix, separated by sep

Examples

subjid_func(5)
#> [1] "id-1" "id-2" "id-3" "id-4" "id-5"
subjid_func(3, suffix = "x")
#> [1] "id-1-x" "id-2-x" "id-3-x"