How do you remove the decimal in a column of ICD codes? [duplicate]
Removing dots is a little bit tricky because they're treated as special characters in regular expressions.
gsub("\\.", "", mydata$ICD_code)
or
gsub(".", "", mydata$ICD_code, fixed = TRUE)
or
gsub("[.]", "", mydata$ICD_code)
(.
is not treated as a special character when it's included in a set of characters with []
)
or the equivalent with stringr::str_remove()