I have a data frame called "stemmoutput" (see below) :
X1 X2 X3 X4 X5 X6 X7 X8 X9 X10
1 tanaman cabai
2 banget hama sakit tanaman
3 koramil nogosari melaks ecek hama tanaman padi ppl ds rambun
And I want to merge multiple columns values into one column like this :
TEXT
1 tanaman cabai
2 banget hama sakit tanaman
3 koramil nogosari melaks ecek hama tanaman padi ppl ds rambun
I have tried this code, and it works
stemmoutput$TEXT <- with(stemmoutput, paste(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10, sep=" "))
but is there any other way that is more efficient, without having to write down the name of the column one by one?
I've also tried this code like below but that didn't work either.
for(i in names(stemmoutput)){
stemmoutput$TEXT <- with(stemmoutput, paste(i, sep=" "))}