nps_calc: Tidy Calculation of Net Promoter Score

Description Usage Arguments Details Value Examples

View source: R/nps_calc.R

Description

Simplifies the calculation of Net Promoter Score (NPS) from raw survey data within the tidyverse framework.

Usage

1
nps_calc(survey_data, ...)

Arguments

survey_data

Raw survey data. Needs to be one row per survey with the nps question in a numeric column called nps_question

...

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

Details

Net Promoter Score was originally developed by Fred Reichheld and now is owned by Bain Company and Satmetrix Systems. According to Wikipedia it "is a management tool that can be used to gauge the loyalty of a firm's customer relationships."

Value

Data frame with nps and survey count for each combination of the grouping variables

Examples

1
2
3
4
5
nps_question <- sample(10, 100, replace = TRUE)
nps_date <- rep(seq.Date(from = as.Date("2019-01-01"), to = as.Date("2019-01-10"), by = "day"), 10)
nps_group <- rep(c("a", "b", "c", "d"), 25)
df <- data.frame(nps_question, nps_date, nps_group)
nps_calc(df, nps_group)

Example output

# A tibble: 4 x 3
  nps_group   nps survey_count
  <chr>     <dbl>        <dbl>
1 a          -12            25
2 b          -40            25
3 c          -28.           25
4 d          -32            25

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