title: Using lapply to recode variables and paste an index number
body: <p>I'm trying to wrap my head around how to use <code>lapply</code> to recode several variables while pasting in the last value of the variable name into the string.</p>
  
  <p>Building on <a href="https://stackoverflow.com/questions/8396392/using-seq-along-paste-to-recode-in-a-loop">this post</a>, I know that I can recode several variables at a time:</p>
  
  <p><code>d2 &lt;- lapply(d1, FUN=function(X) recode(X, "'Somewhat interested' ='Somewhat'; 'Not interested' = 'No'"))</code></p>
  
  <p>But, what I need to do is slightly different. Suppose that my data frame has sequentially labeled variables, e.g. <code>var_1</code>, <code>var_2</code>, <code>var_3</code> and looks like this:</p>
  
  <pre><code>    var_1              var_2               var_3                   var_4
  1:                                                                                
  2: Somewhat interested Somewhat interested Somewhat interested      Not interested
  3: Somewhat interested Somewhat interested Somewhat interested      Not interested
  4:      Not interested Somewhat interested Somewhat interested Somewhat interested
  </code></pre>
  
  <p>I want to recode the variable and append the sequential identifier of the column name: </p>
  
  <pre><code>           var_1              var_2              var_3             var_4
  1:                                                                            
  2:         Somewhat 1         Somewhat 2         Somewhat 3               No 4
  3:         Somewhat 1         Somewhat 2         Somewhat 3               No 4
  4:               No 1         Somewhat 2         Somewhat 3         Somewhat 4
  </code></pre>
  
  <p>Thoughts on how to combine <code>recode</code> and <code>paste</code> together?</p>