% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ops.R
\name{ops_snapshot_remove}
\alias{ops_snapshot_remove}
\title{Remove raw source columns recorded at a snapshot}
\usage{
ops_snapshot_remove(data, from, keep = NULL, verbose = TRUE)
}
\arguments{
\item{data}{A data.frame or data.table.}

\item{from}{(character) Label of the snapshot whose columns should be
dropped (typically \code{"raw"}).}

\item{keep}{(character or NULL) Additional column names to protect beyond
the built-in and user-registered safe cols. Default \code{NULL}.}

\item{verbose}{(logical) Print a summary of dropped columns. Default
\code{TRUE}.}
}
\value{
A \code{data.table} with the specified columns removed. For
\code{data.table} input the operation is performed by reference (in-place);
for \code{data.frame} input the data is first converted to a new
\code{data.table} — the original \code{data.frame} is not modified.
}
\description{
Drops columns that were present at snapshot \code{from} from \code{data},
while automatically protecting built-in safe columns
(\code{"eid"}, \code{"sex"}, \code{"age"}, \code{"age_at_recruitment"}) and
any user-registered safe columns set via \code{\link{ops_set_safe_cols}}.
Columns that no longer exist in \code{data} are silently skipped.
}
\examples{
dt <- ops_toy(n = 100)
ops_snapshot(dt, label = "raw")
dt <- derive_missing(dt)
ops_snapshot(dt, label = "derived")
ops_snapshot_diff("raw", "derived")
dt <- ops_snapshot_remove(dt, from = "raw")
}
