Convert given decimal character to dot
Source:R/all_decimal_points_to_dot.R
all_decimal_points_to_dot.RdConvert specified decimal character in numeric-like character to dot.
Details
Has safeguards to only convert numeric-like characters - any non-numeric character will prevent conversion.
Examples
df <- data.frame(x1 = c("1,1", "2,2", " 3,3", "4,4 ", "1,1a"))
all_decimal_points_to_dot(df)
#> Loading required namespace: testthat
#> x1
#> 1 1.1
#> 2 2.2
#> 3 3,3
#> 4 4,4
#> 5 1,1a
# also trim white space
all_decimal_points_to_dot(df, trim_ws = TRUE)
#> x1
#> 1 1.1
#> 2 2.2
#> 3 3.3
#> 4 4.4
#> 5 1,1a