cleanNumbers | R Documentation |
Remove non-numeric characters from otherwise numeric standardized test scores.
cleanNumbers(c)
c |
A character vector of potentially numeric values. |
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).
A character vector
Dave Braze davebraze@gmail.com
parse_number
scrubc()
c <- c("<K.1", "k.8", "2.5", "_4.3", "6.4", "12.9+", "9.2", "10.1", ">12.9") cleanNumbers(c)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.