Description Usage Arguments Examples
This function takes a vector or data frame of currency values in character format, strips out comma delimiters and currency symbols, and converts the result to numeric.
1 | CurrencyToNumeric(data, fields = NA, debug = FALSE)
|
data |
Data frame or character vector to be manipulated |
fields |
Character vector of fields; not necessary if passing a vector |
debug |
If |
1 2 3 4 5 6 7 8 9 10 | cash <- c("10,203¢", "$340", "€8,111.10", "£23,040", "¥8300")
CurrencyToNumeric(cash)
cash.frame <- data.frame(c1 = cash, c2 = cash, c3 = cash, stringsAsFactors = FALSE)
CurrencyToNumeric(cash.frame)
# Note that this unlists the data because no fields were included
CurrencyToNumeric(cash.frame, fields=1:2)
CurrencyToNumeric(cash.frame, fields=c("c2", "c3"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.