sanitizePercent | R Documentation |
Take a character
vector of percentages (e.g. "50%"
) and convert it to a
numeric
vector (e.g. 0.5
).
sanitizePercent(object, ...)
## S4 method for signature 'atomic'
sanitizePercent(object)
## S4 method for signature 'character'
sanitizePercent(object)
object |
Object. |
... |
Additional arguments. |
Modified object.
All percentage strings containing "%"
(e.g. "50%"
) are converted to
numeric proportions (e.g. 0.5
).
This function is designed primarily to sanitize data imported from Microsoft Excel.
Updated 2019-10-12.
## character ====
object <- c("100%", "10.0%", "1%", "0.1%", "0.01%")
object <- sanitizePercent(object)
class(object)
print(object)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.