R, merge multiple rows of text data frame into one cell
merge, r, text-mining
Solution
You have to transform the data frame column into a character vector before using `paste`.
paste(unlist(gettext.df), collapse =" ")
This returns:
[1] "hello, Good to hear back from you. I've currently written an application and I'm happy about it"
Problem
I have a text data frame that looks like below. ``` > nrow(gettext.df) [1] 3 > gettext.df gettext 1 hello, 2 Good to hear back from you. 3 I've currently written an application and I'm happy about it ``` I wanted to merge this text data into one cell (to do sentiment analysis) as below ``` > gettext.df gettext 1 hello, Good to hear back from you. I've currently written an application and I'm happy about it ``` so I collapsed the cell using below code ``` paste(gettext.df, collapse =" ") ``` but it seems like it makes those text data into one chunk (as one word) so I cannot scan the sentence word by word. Is there any way that I can merge those sentence as a collection of sentences, without transforming as one big word chunk?