R, merge multiple rows of text data frame into one cell

前端 未结 1 446
悲哀的现实
悲哀的现实 2021-01-05 16:43

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 curre         


        
相关标签:
1条回答
  • 2021-01-05 17:25

    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"
    
    0 讨论(0)
提交回复
热议问题