Concatenate rows of a data frame

前端 未结 4 1508
醉梦人生
醉梦人生 2020-11-30 07:28

I would like to take a data frame with characters and numbers, and concatenate all of the elements of the each row into a single string, which would be stored as a single el

4条回答
  •  没有蜡笔的小新
    2020-11-30 07:45

    For those using library(tidyverse), you can simply use the unite function.

     new.df<-df%>%
     unite(together, letters, numbers, sep="")
    

    This will give you a new column called "together" with A1, B2, etc

提交回复
热议问题