In R: Joining vector elements by row, converting vector rows to strings

后端 未结 3 488
小蘑菇
小蘑菇 2021-01-04 05:03

Is there a \"by row\" operation in R to convert each row in a vector like this to strings?

> d= cbind(\"Data\", c(\"2\", \"73\"))
> d
     [,1]   [,2]
         


        
3条回答
  •  春和景丽
    2021-01-04 05:18

    After a quick glace at ?paste, it's clear that apply isn't needed for the example given. It would be handy if there are several columns though.

    > paste(d[,1],d[,2])
    [1] "Data 2"  "Data 73"
    

提交回复
热议问题