Learn R Programming

SciencesPo (version 0.11.21)

anonymize: Make Anonymous Data

Description

It replaces factor and character variables by a combination of letters and numbers, the 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.

See Also

soundexBR.

Examples

Run this code
data(tobaccovote)

anonymize(tobaccovote)

anonymize(tobaccovote, keep.names=FALSE)

Run the code above in your browser using DataLab