Given a certain string, e.g., s = \"tesX123\", how can I replace a certain character at a certain location?
s = \"tesX123\"
In this example, the character at position <
Try substr()
substr()
substr(s, 4, 4) <- "t" > s #[1] "test123"
We can use sub
sub
sub("(.{3}).", "\\1t", s) #[1] "test123"