Learn R Programming

blockr.dplyr (version 0.1.0)

new_mutate_expr_block: Mutate expression block constructor

Description

This block allows to add new variables and preserve existing ones using R expressions (see dplyr::mutate()). Changes are applied after clicking the submit button.

Usage

new_mutate_expr_block(exprs = list(new_col = "1"), by = character(), ...)

Value

A block object for mutate operations

Arguments

exprs

Reactive expression returning character vector of expressions

by

Character vector of column names for grouping. Default is empty.

...

Additional arguments forwarded to blockr.core::new_block()

See Also

blockr.core::new_transform_block()

Examples

Run this code
# Create a mutate expression block
new_mutate_expr_block(exprs = list(mpg_squared = "mpg^2"))

if (interactive()) {
  # Basic usage with mtcars datase
  library(blockr.core)
  serve(new_mutate_expr_block(), data = list(data = mtcars))

  # With a custom dataset
  df <- data.frame(x = 1:5, check.names = FALSE)
  df$`2025 Sales` <- letters[1:5]
  serve(new_mutate_expr_block(), data = list(data = df))
}

Run the code above in your browser using DataLab