The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Introduction to marketr

Introduction to marketr

marketr facilitates tidy calculation of popular quantitative marketing metrics (like Customer Experience Index and Net Promoter Score). By “tidy”, I am referring to the usage of the tidyverse packages and methodology for organizing and analyzing data. The package is designed so that beginning R users can calculate these metrics, along many dimensions, without needing to learn much R syntax. It is also helpful for more experienced programmers to do these calculations quickly.

Generate survey response data

To demonstrate the basic usage I will create simulated survey response data. needs, ease and emotion are the columns that make up CXi; nps_question is used for NPS; grps and months will show how these metrics can be calculated along categorical features and/or trended over time.

library(marketr)
## Warning: replacing previous import 'vctrs::data_frame' by 'tibble::data_frame'
## when loading 'dplyr'
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(magrittr)
library(ggplot2)

needs <- sample(2:5, 1000, replace = T)
ease <- sample(2:5, 1000, replace = T)
emotion <- sample(2:5, 1000, replace = T)
nps_question <- sample(3:10, 1000, replace = T)
grps <- c("a", "b", "c")
months <- sample(1:12, 1000, replace = T)

survey_data <- tibble::as_tibble(cbind(needs, ease, emotion, nps_question, grps, months)) %>%
  mutate(month = as.numeric(months))
## Warning in cbind(needs, ease, emotion, nps_question, grps, months): number of
## rows of result is not a multiple of vector length (arg 5)
head(survey_data)
## # A tibble: 6 x 7
##   needs ease  emotion nps_question grps  months month
##   <chr> <chr> <chr>   <chr>        <chr> <chr>  <dbl>
## 1 3     4     5       9            a     2          2
## 2 5     4     5       10           b     12        12
## 3 3     2     4       5            c     1          1
## 4 3     2     4       6            a     3          3
## 5 4     3     3       10           b     9          9
## 6 5     3     2       5            c     6          6

Calculating CXi

Customer Experience Index (CXI) was developed by Forrester. Per Forrester, CXi “measures how successfully a company delivers customer experiences that create and sustain loyalty.”

It involves scoring three questions, each with a likert scale response, and then averaging those scores together. Below, four calculations are done using two different functions.

# Overall CXi
cxi_calc(survey_data) %>% knitr::kable()
cxi survey_count
25.03333 1000
## CXi by group
cxi_calc(survey_data, grps, cx_high = 4, cx_low = 2) %>% knitr::kable()
grps cxi survey_count
a 25.74850 334
b 25.72573 333
c 23.62362 333
# Overall CXi trend
cxi_trend(survey_data, month) %>% knitr::kable() 
avg_survey_ct min_survey_ct month cxi survey_count
83.33333 71 1 23.52941 85
83.33333 71 2 23.07692 91
83.33333 71 3 21.17647 85
83.33333 71 4 27.10623 91
83.33333 71 5 22.22222 72
83.33333 71 6 36.25000 80
83.33333 71 7 21.46119 73
83.33333 71 8 32.65993 99
83.33333 71 9 35.68075 71
83.33333 71 10 12.76596 94
83.33333 71 11 15.98174 73
83.33333 71 12 28.68217 86
# Overall CXi trend by group - plotted
cxi_trend(survey_data, month, grps, cx_high = 4, cx_low = 2, min_surveys = 1, avg_surveys = 0) %>% 
  ggplot(aes(x = month, y = cxi)) +
  geom_line() +
  facet_wrap(grps ~ ., nrow = 3)
## Joining, by = "grps"
## Joining, by = "grps"

Calculating NPS

Net Promoter Score (NPS) was originally developed by Fred Reichheld and now is owned by Bain Company and Satmetrix Systems. The Wikipedia page is another good source of information. According to Wikipedia it “is a management tool that can be used to gauge the loyalty of a firm’s customer relationships.”

The calculation requires a single question with a ten-point scale. Like CXi it is not difficult to do manually; the package enables deeper analysis.Below, four calculations are done using two different functions.

# Overall NPS
nps_calc(survey_data) %>% knitr::kable()
nps survey_count
-51.3 1000
## NPS by group
nps_calc(survey_data, grps) %>% knitr::kable()
grps nps survey_count
a -45.50898 334
b -57.35736 333
c -51.05105 333
# Overall NPS trend
nps_trend(survey_data, month) %>% knitr::kable()
avg_survey_ct min_survey_ct month nps survey_count
83.33333 71 1 -44.70588 85
83.33333 71 2 -45.05495 91
83.33333 71 3 -50.58824 85
83.33333 71 4 -58.24176 91
83.33333 71 5 -62.50000 72
83.33333 71 6 -52.50000 80
83.33333 71 7 -39.72603 73
83.33333 71 8 -57.57576 99
83.33333 71 9 -29.57746 71
83.33333 71 10 -55.31915 94
83.33333 71 11 -46.57534 73
83.33333 71 12 -67.44186 86
# Overall NPS trend by group - plotted
nps_trend(survey_data, month, grps, min_surveys = 1, avg_surveys = 0) %>% 
  ggplot(aes(x = month, y = nps)) +
  geom_line() +
  facet_wrap(grps ~ ., nrow = 3)
## Joining, by = "grps"
## Joining, by = "grps"

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.