cxi_trend: Tidy Calculation of Customer Experience Index trends by group

Description Usage Arguments Details Value Examples

View source: R/cxi_trend.R

Description

Simplifies the calculation of Customer Experience Index (CXi) trends over time from raw survey data within the tidyverse framework.

Usage

1
2
3
4
5
6
7
8
9
cxi_trend(
  survey_data,
  trend_var,
  ...,
  cx_high = 4,
  cx_low = 2,
  min_surveys = 1,
  avg_surveys = 0
)

Arguments

survey_data

Raw survey data. Needs to be one row per survey with the three CXi question responses having column names of needs, ease and emotion

trend_var

Column that represents an element of time, eg week number, date, month & year

...

optional columns by which to group the CXi calculation. There is no limit to the number of grouping variables chosen. Too many will likely result in CXi calculations that are too fragmented / based on very small survey counts.

cx_high

Threshold in scale where response at or above is a "high"

cx_low

Threshold in scale where response at or below is a "low"

min_surveys

Minimum surveys found in every period for each group to be included

avg_surveys

Average surveys found in every period for each group to be included

Details

Customer Experience Index is a metric created by Forrester to help companies systematically measure customer experience in a way that their research has found is connected to improving customer loyalty. More information can be found at https://go.forrester.com/analytics/cx-index/

The calculation across an entire sample of surveys is simple. A customer experience manager may want to calculate CXi across many different dimensions and filtering in different ways; the functions in this package utilize the tidy framework to streamline calculating CXi along as many dimensions as desired.

The trend version of the function allows you to specify one column as a date over which to trend the data. This allows quick filtering to eliminate groupings that fail to meet user-specified thresholds for average or minimum survey counts per time period.

The resulting data set is set up for creating faceted line plots using ggplot2.

Value

Data frame with CXi and survey count for each combination of the grouping variables over the time variable.

Examples

1
2
3
4
5
6
7
needs <- sample(5, 100, replace = TRUE)
ease <- sample(5, 100, replace = TRUE)
emotion <- sample(5, 100, replace = TRUE)
cx_date <- rep(seq.Date(from = as.Date("2019-01-01"), to = as.Date("2019-01-10"), by = "day"), 10)
cx_group <- rep(c("a", "b", "c", "d"), 25)
df <- data.frame(needs, ease, emotion, cx_date, cx_group)
cxi_trend(df, cx_date, cx_group)

Example output

Joining, by = "cx_group"
Joining, by = "cx_group"
# A tibble: 20 x 6
   cx_group cx_date       cxi survey_count avg_survey_ct min_survey_ct
   <chr>    <date>      <dbl>        <dbl>         <dbl>         <dbl>
 1 a        2019-01-01 -20               5             5             5
 2 a        2019-01-03 -13.3             5             5             5
 3 a        2019-01-05   0               5             5             5
 4 a        2019-01-07   6.67            5             5             5
 5 a        2019-01-09  13.3             5             5             5
 6 b        2019-01-02 -13.3             5             5             5
 7 b        2019-01-04 -40               5             5             5
 8 b        2019-01-06   6.67            5             5             5
 9 b        2019-01-08 -13.3             5             5             5
10 b        2019-01-10 -26.7             5             5             5
11 c        2019-01-01 -13.3             5             5             5
12 c        2019-01-03 -13.3             5             5             5
13 c        2019-01-05   6.67            5             5             5
14 c        2019-01-07 -13.3             5             5             5
15 c        2019-01-09  33.3             5             5             5
16 d        2019-01-02  20               5             5             5
17 d        2019-01-04  -6.67            5             5             5
18 d        2019-01-06  13.3             5             5             5
19 d        2019-01-08  -6.67            5             5             5
20 d        2019-01-10   0               5             5             5

marketr documentation built on Dec. 18, 2020, 9:07 a.m.