nps_calc {marketr} | R Documentation |
Tidy Calculation of Net Promoter Score
Description
Simplifies the calculation of Net Promoter Score (NPS) from raw survey data within the tidyverse framework.
Usage
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
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)