title: Replace non-ascii chars with a defined string list without a loop in R
body: <p>I want to replace non-ascii characters (for now, only spanish), by their ascii equivalent. If I have "á", I want to replace it with "a" and so on. </p>
  
  <p>I built this function (works fine), but I don't want to use a loop (including internal loops like sapply).</p>
  
  <pre><code>latin2ascii&lt;-function(x) {
  if(!is.character(x)) stop ("input must be a character object")
  require(stringr)
  mapL&lt;-c("á","é","í","ó","ú","Á","É","Í","Ó","Ú","ñ","Ñ","ü","Ü")
  mapA&lt;-c("a","e","i","o","u","A","E","I","O","U","n","N","u","U")
  for(y in 1:length(mapL)) {
    x&lt;-str_replace_all(x,mapL[y],mapA[y])
    }
  x
  }
  </code></pre>
  
  <p>Is there an elegante way to solve it? Any help, suggestion or modification is appreciated</p>