I want to convert each row into a character consisting of the values in each column.
head(sequence_mat, 5)
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0 0 0 0 0 0
[2,] 0 1 0 0 0 0
[3,] 0 0 1 0 0 0
[4,] 0 0 0 1 0 0
[5,] 0 0 0 0 1 0
For example, sequence_mat[1,] = 0 0 0 0 0 0
and I want it to become "0-0-0-0-0-0"
.
I tried as.character(sequence_mat[1,])
but the output is not what I want, i.e. [1] "0" "0" "0" "0" "0" "0"