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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.