Description Usage Arguments Value Examples
add()
is wrapper function of gmutate()
and gsummarize()
.
gmutate()
adds aggregated metrics as variables to the given data frame.
gsummarize()
aggregates metrics from the given data frame.
gsummarize()
and gsummarise()
are
synonyms.
measure()
and add()
are also synonyms.
1 2 3 4 5 6 7 8 9 |
df |
Data frame. |
... |
Variables to group by. |
metrics |
Metrics defined by |
summarize |
Summarization flag. If it is |
is_filtered |
Filter metrics which does not work for df or not |
Data frame with calculated metrics
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Prepare data frame
df <- data.frame(
gender = rep(c("M", "F"), 5),
age = (1:10)*10,
cost = (51:60),
impression = (101:110),
click = (0:9)*3
)
# Define metrics
metrics <- mmetrics::define(
count = n(),
cost = sum(cost),
ctr = sum(click)/sum(impression)
)
# Evaluate
mmetrics::add(df, gender, metrics = metrics)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.