Public-Health-Scotland / phsmethods

An R package to standardise methods used in Public Health Scotland (https://public-health-scotland.github.io/phsmethods/)
https://public-health-scotland.github.io/phsmethods/
54 stars 13 forks source link

CHI check return values #76

Closed Moohan closed 2 years ago

Moohan commented 2 years ago

I was just using chi_check and noticed it returns "Too few characters" for the empty string "", whilst this is technically correct (the string has 0 characters), it's not what I would have expected. I would have expected it to return "Missing" as it does for NA.

library(phsmethods)

chi_check(c("", NA))

[1] "Too few characters" "Missing"

It would be simple to change this and I'd be happy to do a PR, if others agree with the change?

Tina815 commented 2 years ago

I would leave it as I think "too few characters" is enough to remind users what happened.

Moohan commented 2 years ago

Spoke to Tina on teams and I'll do a PR to change this so that we have 2 categories 'Missing (NA)' and 'Missing (Blank)'. 'Missing (NA)' will be the current 'Missing' and 'Missing (Blank)' will be for the empty string ""