string <- "This has been identified, i.e., found."
I want to remove "i.e." from the string. However, using
> gsub("i.e.", "", string)
[1] "This has been tified, , found."
also removes "iden" from "identified". How do I write a regex that specifically targets "i.e."? I think the periods in "i.e." are triggering another regex expression than what I intended.
>Solution :
Use fixed = TRUE, otherwise . is identified as a meta-character. You can also use i\\.e\\..
gsub("i.e.", "", string, fixed = TRUE)
#[1] "This has been identified, , found."