auto_mutate: Mutate with automatic codebook registration

View source: R/02_verbs.R

auto_mutateR Documentation

Mutate with automatic codebook registration

Description

Works exactly like dplyr::mutate(), but also captures each expression and registers the resulting variable in the codebook. Type, source columns, categories, and source code are inferred automatically - you only need to provide human-readable labels.

Usage

auto_mutate(.data, labels = list(), block = "", ...)

Arguments

.data

A Spark DataFrame (tbl_spark) or local data frame.

labels

Named list mapping variable names to labels (descriptions). Variables not in this list get their own name as label.

block

Optional character label for the pipeline block/section (e.g. "Demographic variables"). Groups variables in the codebook.

...

Named expressions, same syntax as dplyr::mutate().

Value

The transformed data frame (same class as input).


autocodebook documentation built on June 9, 2026, 1:09 a.m.