Description Usage Arguments Details Value Author(s) Examples
Remove internal commas from numbers and convert to numeric
1 | remove_comma(x)
|
x |
vector of numbers that has been imported as character because of internal commas (e.g., "1,000") |
This function handles vectors of numbers that have been imported as character
or factor
values due to the inclusion of an internal comma (e.g. "14,300" instead of "14300"). The function removes all internal commas and then converts it to numeric.
Returns a numeric vector
Julie Padilla
1 2 3 4 5 | x <- c('14,300', 1, 2, 5, 7)
y <- as.factor(x)
remove_comma(x)
remove_comma(y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.