title: Count word frequency across multiple columns in R
body: <p>I have a data frame in R with multiple columns with multi-word text responses, that looks something like this:</p>
  
  <pre><code>1a        1b             1c       2a          2b             2c
  student   job prospects  money    professors  students       campus
  future    career         unsure   my grades   opportunities  university
  success   reputation     my job   earnings    courses        unsure
  </code></pre>
  
  <p>I want to be able to count the frequency of words in columns 1a, 1b, and 1c combined, as well as 2a, 2b, and 2b combined. </p>
  
  <p>Currently, I'm using this code to count word frequency in each column individually. </p>
  
  <pre><code>data.frame(table(unlist(strsplit(tolower(dat$1a), " "))))
  </code></pre>
  
  <p>Ideally, I want to be able to combine the two sets of columns into just two columns and then use this same code to count word frequency, but I'm open to other options.</p>
  
  <p>The combined columns would look something like this:</p>
  
  <pre><code>1              2
  student        professors
  future         my grades
  success        earnings
  job prospects  students
  career         opportunities
  reputation     courses
  money          campus
  unsure         university
  my job         unsure
  </code></pre>