title: Replacing numbers with text in a dataframe
body: <p>I'm sure there is a simple answer but I've been searching and I couldn't find anything on this.</p>
  
  <p>I have a data frame (sdata) with a column named "<code>landcover</code>"  This is a categorical variable but as of now each landcover type is indicated by a number.  </p>
  
  <p>I'd like to replace the landcover number codes with text and have figured out how to do this partly with:</p>
  
  <pre><code>sdata$landcover&lt;- as.factor(sdata$landcover)
  levels(sdata$landcover) &lt;- gsub("1", "w.subboreal", levels(sdata$landcover))
  levels(sdata$landcover) &lt;- gsub("2", "PICO", levels(sdata$landcover))
  levels(sdata$landcover) &lt;- gsub("3", "ABLA.PIEN", levels(sdata$landcover))
  levels(sdata$landcover) &lt;- gsub("5", "dry.forest", levels(sdata$landcover))
  levels(sdata$landcover) &lt;- gsub("10", "shrubby", levels(sdata$landcover))
  levels(sdata$landcover) &lt;- gsub("11", "agriculture", levels(sdata$landcover))
  levels(sdata$landcover) &lt;- gsub("13", "disturbed", levels(sdata$landcover))
  </code></pre>
  
  <p>This works for single digit numbers but, for example, the number 13 turns into "<code>w.subborealABLA.PIEN</code>"(i.e. combination of 1 and 3) and the number 10 turns into "<code>w.subboreal0</code>" (combination of 1 and 0).  How can I make sure that double digit numbers are considered as one number, not two separate single digit numbers to be replaced? 
  Thank you!</p>