# Create a summarize block
new_summarize_block()
if (interactive()) {
# Basic usage with mtcars dataset
library(blockr.core)
serve(new_summarize_block(), data = list(data = mtcars))
# With predefined summaries
serve(
new_summarize_block(
summaries = list(
avg_mpg = list(func = "mean", col = "mpg"),
max_hp = list(func = "max", col = "hp")
)
),
data = list(data = mtcars)
)
# With grouping
serve(
new_summarize_block(
summaries = list(avg_mpg = list(func = "mean", col = "mpg")),
by = "cyl"
),
data = list(data = mtcars)
)
}
Run the code above in your browser using DataLab