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.
lapply
, but as you want to replace different patterns with different strings, I think you will still have to specified these one way or another... – Wrigglerchartr
to do this. – Odontographgsubfn
function in thegsubfn
package is a generalization ofgsub
that can do that in one call:gsubfn(".", list("á"="a", "é"="e", "ó"="o"), c("á","é","ó"))
– Emend