Confidentialise Your Data with the randomNames Package

Sensitive data has it’s restrictions for good reason. Personal data such as names and other identifiable information should be protected. Policies are in place to prevent any accidental data breach by governments and businesses. This can be hurdle for data projects, particularly when socialising your work. A common technique is to strip the individuals name and replace it with a random number. This is fine and does the job but the story is much better told when you can refer to a person. Another method is to randomise the names in the list giving each individual a random name first and last name that is present in your data. This often leaves you with unease because what if, by chance you randomly assign the same name to someone? It could happen to a John Smith.

A better way is to use the randomNames package. It’s simple and easy to use and an important step can be done without too much thought. Simply use the function below.

Other parameters control the sex and ethnicity of the name.

Perhaps you only need the first or last name to be confidentialised.

You can also sample the whole feature set if needed randomising gender and ethnicity.

Addresses are also sensitive since they can be identifiable, whether it’s the property, business or the persons which reside within them. Here’s a freebie, a simple function that uses the randomNames package to generate fake addresses.

Not the most accurate recreation of Australian addresses but it’s not bad. The proportions are consistent with the current Australian population figures. This looks better and is easier to tell a story with these address rather than labelling every address as “1 Aardvark Ave”… which I have regretfully done before. I intend to build a much better function which offers more flexibility when randomising addresses which simulate the Australian populaltion and allows you to subset the addresses to a user definied set of states, postcode, more realistic set of unit numbers, etc. But for now this does the job.

Follow me on social media: