Simulating strings for complex identifiers

It's time for the most complex part of the simulation, the identifiers. We want to produce n identifiers, and, depending on what identifiers we are simulating, we may want them to be unique. Client identifiers in the client data must be unique, because we don't want two distinct clients with the same identifier, and our clients' data will not have repeated records by design. On the other hand, we don't want unique client identifiers in the sales data, because we want repeated clients to appear in there.

We could create two distinct functions that take care of these cases independently, but it's easy enough to combine them into a single function by just using a reduction parameter that specifies the ...

Get R Programming By Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.