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).
Arguments
- x
A numeric vector of 0-10 ratings (character input is coerced).
- labels
If
FALSE(default) returns the signed integer coding-1 / 0 / 1used bycalc_nps(). IfTRUEreturns 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.
