I want to group the words of string(given below)
text=\"Lorem,ipsum,dolor,sit,amet,consectetuer\"
like this
textNew=\"Lore
Ahh got something similar.
text="Lorem,ipsum,dolor,sit,amet,consectetuer" text2 <- unlist(strsplit(text, ",")) textNew=paste0(sapply(1:(length(text2)-1),function(i,y=text2){paste(y[i],y[i+1])}),collapse=",")