mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2026-06-19 12:37:30 +02:00
25 lines
501 B
Markdown
25 lines
501 B
Markdown
# Evaluate an expression while preserving column labels
|
|
|
|
Snapshots labels from `df` before evaluating `expr`, then reapplies them
|
|
to matching columns in the result. New columns created inside `expr`
|
|
receive no label automatically.
|
|
|
|
## Usage
|
|
|
|
``` r
|
|
with_labels(df, expr)
|
|
```
|
|
|
|
## Arguments
|
|
|
|
- df:
|
|
|
|
A data frame carrying `"label"` attributes.
|
|
|
|
- expr:
|
|
|
|
An unquoted expression that transforms `df` and returns a data frame.
|
|
|
|
## Value
|
|
|
|
The data frame produced by `expr`, with original labels restored.
|