title: R Use factor() for nominal data - how to value labels for multiple variables
body: <p>I'm an R newbie so this problem is probably quite obvious but I have had a good search around and can't find anything. </p>
  
  <p>I'm wanting to use R to analyse a survey rather than the usual method excel.</p>
  
  <p>I have my variables labeled as Q1, Q2, Q3...</p>
  
  <p>Q1 and Q2 contains nominal data (1, 2) and I'd like the values replacing with ("Yes", "No"). I can do this for Q1 using the code below but I'm not sure if I should subset or use c( to use the factor function. The survey will have about 25 questions this will need applying to so I'd rather it be done in one line of code rather than 25. </p>
  
  <p><code>resdata$Q1 &lt;- factor(resdata$Q1, levels = c(1,2), labels = c("Yes", "No"))</code></p>