fork download
  1. a <- data.frame(id=c(1,2,2,2,3),icd9=c("0781","00840","8660","7100","25011"))
  2. sub('^(\\d{3})(\\d)', '\\1.\\2', a$icd9)
  3. # => [1] "078.1" "008.40" "866.0" "710.0" "250.11"
Success #stdin #stdout 0.22s 38892KB
stdin
Standard input is empty
stdout
[1] "078.1"  "008.40" "866.0"  "710.0"  "250.11"