paste - R - Collapse By Row -


i need collapse data by row.

seq = structure(c("h", "d", "s", "s", "f", "k", "s", "s", "f", "d",  "d", "d", "l", "l", "d", "d"), .dim = c(4l, 4l), .dimnames = list( null, c("act1.055", "act1.056", "act1.057", "act1.058"))) 

my data :

     act1.055 act1.056 act1.057 act1.058 [1,] "h"      "f"      "f"      "l"      [2,] "d"      "k"      "d"      "l"      [3,] "s"      "s"      "d"      "d"      [4,] "s"      "s"      "d"      "d"  

if

paste(seq, collapse = "") [1] "hdssfkssfdddlldd" 

which not want.

what need

hffl dkdl  ssdd  ssdd 

in matrix if possible.

matrix(apply(seq, 1, paste, collapse=''), ncol=1) #     [,1]   #[1,] "hffl" #[2,] "dkdl" #[3,] "ssdd" #[4,] "ssdd" 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -