title: Transform column of strings with word cluster values
body: <p>I am doing some basic NLP work in R. I have two data sets and want to replace the words in one with the cluster value of each word from the other. </p>
  
  <p>The first data set holds sentences and the second one the cluster value for each word (assume that every word in first data set has a cluster value):</p>
  
  <pre><code>original_text_df &lt;- read.table(text="Text
  'this is some text'
  'this is more text'", header=T, sep="") 
  
  cluster_df &lt;- read.table(text="Word Cluster
  this 2
  is 2 
  some 3
  text 4
  more 3", header=T, sep="") 
  </code></pre>
  
  <p>This is the desired transformed output:</p>
  
  <pre><code>Text
  "2 2 3 4"
  "2 2 3 4"
  </code></pre>
  
  <p>Looking for an efficient solution as I have long sentences and many of them. Thanks!</p>