View source: R/09_transforming.R
series_mutate | R Documentation |
This function performs transformations on specified columns of a data frame, including truncating maximum values, handling negative values, and adding a zero to the series. It allows for grouping and supports retaining metadata in the output.
series_mutate(
data,
x,
y,
grp,
metadata,
max_as_last = FALSE,
check_negative = FALSE,
add_zero = FALSE,
interval = NULL
)
data |
A |
x |
The name of the column in |
y |
The name of the column(s) in |
grp |
Column(s) in |
metadata |
Names of columns to retain in the output. Defaults to |
max_as_last |
Logical. If |
check_negative |
Logical. If |
add_zero |
Logical. If |
interval |
A numeric vector of length 2 (start and end) specifying the range to filter the data. Defaults to |
A transformed data.frame
with the specified modifications applied.
data(dt_potato)
new_data <- series_mutate(
data = dt_potato,
x = DAP,
y = GLI,
grp = gid,
max_as_last = TRUE,
check_negative = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.