R/cleanNumbers.R
cleanNumbers.Rd
Remove non-numeric characters from otherwise numeric standardized test scores.
cleanNumbers(c)
c | A character vector of potentially numeric values. |
---|
A character vector
Remove or replace non-numeric characters that sometimes occur in otherwise numeric standardized test scores. Several characters are handled specially. These four characters "<>+*" are simply removed. The letter "K" is replaced with "0" (zero). All other non-numeric characters are removed. A count of each type of character removed or replaced is printed to the console.
cleanNumbers()
calls helper functions scrubc()
and
swapc()
to do its work.
Advantages over parse_number
are that it provides
explicit alerts as to what characters are being removed or replaced and
in what quantity. Useful in cases where you are working with unfamiliar
data (e.g., client data, or found data).
Dave Braze davebraze@gmail.com
#> Removing 1 characters from "<" #> Removing 1 characters from ">" #> Replacing 2 characters from [Kk] with '0'. #> Removing 1 characters from "+" #> Removing 1 characters from "_" #>#> [1] "0.1" "0.8" "2.5" "4.3" "6.4" "12.9" "9.2" "10.1" "12.9"