A defensive helper for the common survey-export headache where a column that
should be numeric arrives as text – "25 years", "8 - very likely",
"3.5/5". It returns x unchanged if it is already numeric; otherwise it
pulls the first number out of each value (via a digit pattern) and coerces to
numeric, leaving genuinely unparseable entries as NA. The ezrsurvey
functions that need numbers (e.g. calc_nps(), calc_summary()) call this
for you, so they "just work" on lightly messy data.
Details
The first numeric token in each value is extracted with the pattern
-?[0-9]*\.?[0-9]+, which captures negatives and decimals but takes only the
first number it finds – so "8 - very likely" becomes 8, not -8. A
value that is genuinely numeric already is returned untouched (no copy, no
message). When quiet = FALSE a single informative message reports that
coercion happened and how many values could not be parsed; the internal
callers (calc_nps(), calc_summary(), ipm_model(), bin_numeric(), ...)
pass quiet = TRUE so they don't spam your console. Truly blank entries
(""/NA) are not counted as parse failures.
