title: Is it possible to map one string to another using a dictionary-like object in R?
body: <p>I want to map one string to another in R, using a dictionary-like object as seen in Python. For example, in Python, you can define a dictionary to convert one string to another, like:</p>
  
  <pre><code>d = {"s": "Superlative", "d": "Dynamic", "f": "Furious"}
  pd.apply(lambda x: d[x["map_column"]], axis=1)
  </code></pre>
  
  <p>However, in R, if you want to convert a set of strings in one column to another one based on such mapping, you would end up defining a function that takes a lot of <code>if else</code>, like:</p>
  
  <pre><code>mapper &lt;- function(x) {
      if (x = "s") {
          return ("Superlative")
      } else if (x = "d") {
              return ("Dynamic")
      }...
  
      return("")
  }
  </code></pre>
  
  <p>But I don't like to define such a long, long function. So is it possible to define a dictionary, or more specifically, to get the result with far fewer, one-line (or two) code in R?</p>