pivot: Pivot Table

Description Usage Arguments Examples

View source: R/counterfactual_f.R

Description

Data transformation

Usage

1
pivot(data_input, columns, groups)

Arguments

data_input

Data

columns

Columns representing different values

groups

Name of the groups

Examples

1
2
3
4
5
6
7
8
9
## Calculate counterfactual scenarios under different scenarios

data("sales_data")
sales_data %>%
  pivot(c("cs1", "cs2"), c("cs1", "cs2")) %>%
  filter(date %in% c(baseline_period, campaign_period)) %>%
  ggplot() +
  geom_line(aes(x = date, y = total, col = group)) +
  geom_vline(xintercept = min(campaign_period))

monkeypostulate/MarketingAnalyticsR documentation built on Feb. 9, 2020, 12:15 a.m.