of course I could replace specific arguments like this:
mydata=c("á","é","ó")
mydata=gsub("á","a",mydata)
mydata=gsub("é","e",mydata)
mydata=gsub("ó","o",mydata)
mydata
but surely there is a easier way to do this all in onle line, right? I dont find the gsub help to be very comprehensive on this.
This is very similar to @kith, but in function form, and with the most common diacritcs cases:
Not so elegant, but it works and does what you want
A problem with some of the implementations above (e.g., Theodore Lytras's) is that if the patterns are multiple characters, they may conflict in the case that one pattern is a substring of another. A way to solve this is to create a copy of the object and perform the pattern replacement in that copy. This is implemented in my package bayesbio, available on CRAN.
Here is a test case:
Maybe this can be usefull:
Another
mgsub
implementation usingReduce
You can use
stringi
package to replace these characters.