IS
применитель к текущему вопросу я бы предпочел такой ответ:
library(stringi)
library(magrittr)
c(510, 1024, 503050) %>%
as.character() %>%
stri_replace_first_regex("(\\d)(\\d*?)0*$", "$1.$2")
>
[1] "5.1" "1.024" "5.0305"
Size: a a a
IS
library(stringi)
library(magrittr)
c(510, 1024, 503050) %>%
as.character() %>%
stri_replace_first_regex("(\\d)(\\d*?)0*$", "$1.$2")
[1] "5.1" "1.024" "5.0305"
IS
stringi
быстрее чем gsub
и построен на базе ICU
;E
E
sub( '(?<=.{1})', '.', x, perl=TRUE )
NB
ДВ
DK
БА
DK
AP
DK
AP
DK
AP
ДВ
DK
DK
AP
ДВ
ДВ