id - Generate a sequential character vector of
zero-padded identification numbers (IDs).
id_factor - Generate a sequential factor vector
of zero-padded identification numbers (IDs).
Usage
id(n, random = FALSE, name = "ID")
id_factor(n, random = FALSE, name = "ID")
Arguments
n
The number elements to generate. This can be globally set within
the environment of r_data_frame or r_list.
random
logical. If TRUE the IDs are randomized, otherwise the
IDs are sequential.
name
The name to assign to the output vector's varname
attribute. This is used to auto assign names to the column/vector name when
used inside of r_data_frame or r_list.
Value
Returns a (optionally random) vector of
character/factor observations
ID numbers.
Warning
id uses sprintf to generate the
padded ID. Per sprintf's documentation: ``The format
string is passed down the OS's sprintf function...The behaviour on inputs not
documented here is 'undefined', which means it is allowed to differ by
platform.'' See sprintf for details.