title: Concatenating strings with
body: <p>I have a data frame with several variables. What I want is create a string using (<em>concatenation</em>) the variable names but with something else in between them...</p>
  
  <p>Here is a simplified example (<strong>number of variables reduced to only 3 whereas I have actually many</strong>)</p>
  
  <p><strong>Making up some data frame</strong>   </p>
  
  <pre><code> df1 &lt;- data.frame(1,2,3) # A one row data frame
    names(df1) &lt;- c('Location1','Location2','Location3') 
  </code></pre>
  
  <p><strong>Actual code...</strong></p>
  
  <pre><code>  len1 &lt;- ncol(df1)
    string1 &lt;- 'The locations that we are considering are'  
      for(i in 1:(len1-1))   string1 &lt;- c(string1,paste(names(df1[i]),sep=','))
  
    string1 &lt;- c(string1,'and',paste(names(df1[len1]),'.'))
    string1
  </code></pre>
  
  <p>This gives...</p>
  
  <pre><code>[1] "The locations that we are considering are"
  [2] "Location1"                          
  [3] "Location2"                          
  [4] "Location3 ."
  </code></pre>
  
  <p>But I want </p>
  
  <p><strong>The locations that we are considering are Location1, Location2 and Location3.</strong></p>
  
  <p>I am sure there is a much simpler method which some of you would know...
  Thank you for you time...</p>