% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mask_identity.R
\name{mask_identity}
\alias{mask_identity}
\title{Interactive Identity Masker}
\usage{
mask_identity(envir = parent.frame())
}
\arguments{
\item{envir}{The environment to search for data frames and in which to save
the anonymized dataset. Defaults to the calling environment.}
}
\value{
Invisibly returns the anonymized data frame.
}
\description{
Safely anonymizes Personally Identifiable Information ('PII') in a dataset
by interactively prompting the user to keep, drop, or scramble each column.
}
\details{
The function provides a guided workflow for data anonymization:
\enumerate{
  \item Scans the calling environment for available data frames and prompts the user to select one.
  \item Iterates through every column in the selected data frame, displaying its name and type.
  \item For each column, the user chooses one of three actions:
      \itemize{
        \item \strong{Keep}: Leaves the column unchanged.
        \item \strong{Scramble}: For numeric data, it shuffles the values to preserve the distribution while breaking the link to individuals. For text/factors, it replaces values with sequential placeholders (e.g., "Masked_0001").
        \item \strong{Drop}: Removes the column entirely from the dataset.
      }
  \item Saves the resulting anonymized data frame back to \code{envir} with a \code{_masked} suffix.
  \item Optionally generates a \code{dput()} output of the first 20 rows for easy, safe sharing.
}
}
\section{Warning}{

This function modifies files on disk or the global environment. Please ensure you have a backup or are using version control (e.g., Git) before execution.
}

\examples{
if (interactive()) {
  mask_identity()
}
}
