remove_comma: Remove commas in numeric values

Description Usage Arguments Details Value Author(s) Examples

View source: R/remove_comma.R

Description

Remove internal commas from numbers and convert to numeric

Usage

1

Arguments

x

vector of numbers that has been imported as character because of internal commas (e.g., "1,000")

Details

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.

Value

Returns a numeric vector

Author(s)

Julie Padilla

Examples

1
2
3
4
5
x <- c('14,300', 1, 2, 5, 7)
y <- as.factor(x)

remove_comma(x)
remove_comma(y)

LimnoTech/limnotools documentation built on May 17, 2019, 9:10 a.m.