Skip to contents

Collapses an 0-10 "how likely to recommend" question into the three standard NPS groups: detractors (0-6), passives (7-8) and promoters (9-10).

Usage

nps_group(x, labels = FALSE)

Arguments

x

A numeric vector of 0-10 ratings (character input is coerced).

labels

If FALSE (default) returns the signed integer coding -1 / 0 / 1 used by calc_nps(). If TRUE returns the labels "Detractor" / "Passive" / "Promoter".

Value

Either an integer vector (-1/0/1) or a character vector, the same length as x. Out-of-range or missing values become NA.

Details

The signed -1/0/1 coding is deliberate: the mean of it, times 100, is exactly the Net Promoter Score (% promoters minus % detractors), which is how calc_nps() computes the headline number. Inputs are run through ensure_numeric() first, so worded answers like "9 - very likely" are classified correctly. Values outside 0–10 (and NA) return NA.

Examples

nps_group(c(0, 6, 7, 8, 9, 10))
#> [1] -1 -1  0  0  1  1

nps_group(c(3, 8, 10), labels = TRUE)
#> [1] "Detractor" "Passive"   "Promoter"