title: gather strings, separate them by a comma
body: <p>I have used paste and gsub before. I have a couple of years experience in R. However now I am not looking to simply merge strings into one. I need the strings to stay seperated and just divided by a comma:</p>
  
  <pre><code>one &lt;- letters[1:9]
  assigned.object &lt;- somefunction(one,sep=",")
  assigned.object
  [1] "a","b","c","d","e","f","g","h","i"
  </code></pre>
  
  <p>Also searched the site and <a href="https://stackoverflow.com/questions/27123597/what-is-the-use-of-sep-in-paste-command-of-r">this thread and its duplicate don't answer my question</a>. Could not find any other answers to this issue. Anybody knows a way in R? </p>
  
  <p>ANSWER:</p>
  
  <p>The duplicate answers the question. However if you need to assign an object to what you directly want this happens: </p>
  
  <pre><code>cat(paste("\"",as.character(one),"\"",collapse=", ",sep=""))
  [1] "a","b","c","d","e","f","g","h","i"
  assigned.object &lt;- cat(paste("\"",as.character(one),"\"",collapse=", ",sep=""))
  assigned.object
  NULL
  </code></pre>
  
  <p>The reason is that there is somewhat an 'error in translation': R can print the object I want, but not store it like the this. The object I want needs to be stored like this: </p>
  
  <pre><code>assigned.object &lt;- paste("\"",as.character(one),"\"",collapse=", ",sep="")
  assigned.object
  [1] "\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\""
  </code></pre>
  
  <p>which looks like this if you save it in a txt-file</p>
  
  <pre><code>"a","b","c","d","e","f","g","h","i"
  </code></pre>
  
  <p>Basically R needs to insert a '\' to distinguish between quotes in the character and those quotes which define beginning and ending in the character. </p>