How would I replace all but the last period with underscore?
x <- "foo.foo.foo.foo.f" # "foo_foo_foo_foo.f"
Maybe this is helpful
library(stringi) stri_replace_last(str = stri_replace_all(str = x,regex = "\.",replacement = "\_"),regex = "\_",replacement = "\.")
1.4m articles
1.4m replys
5 comments
56.9k users