Learn R Programming

SciencesPo (version 1.02.12)

anonymize: Make Data Anonymous

Description

This function replaces factor and character variables by a combination of letters and numbers, and numeric columns are also transformed.

Usage

anonymize(x, keep.names = TRUE)

Arguments

x
A vector or a data frame
keep.names
A logical argument. If FALSE, variable names will be replaced by Xs

Value

  • An object of the same type as x

encoding

UTF-8

Details

By making difficult to recognize the original data while keeping the same data structure, this function is quite useful for sharing data on help lists.

Examples

Run this code
# setup data
data(ssex)
anonymize(ssex)
anonymize(ssex, keep.names=FALSE)

Run the code above in your browser using DataLab