I am trying to build a long string of the form.....\'name1\',\'name2\',\'name3\',..etc
. How do I do it ? I am trying to do it using R ? By hand is impossible as there are currently over 200 such names and in future I may have more. So I need to automate the process. However, every time I tried to use R's paste0 function I am getting a different result. Here is what I did:
t <- c()
for( nms in name){ t <- paste0(t, paste0("\\'",nms,"\\'", sep = ",") ) }
However, the result turns out to include double backslashes instead of one, like this "\\'name1\\',\\'name2\\',\\'name3\\'
etc. I couldn't get a single backslash as I want.
Any help would be appreciated.
Thanks.
\\'name1\\', etc
. Inside read.csv, double backslashes produces error. It only take single backslash. $\endgroup$write.csv(t,"t.csv")
it gives the desired result means that R internally stores it as expected $\endgroup$