Using R trying to merge raw matrix to result a matrix based on the value of the row value.

Ex:

from:

1 2a1 10a1 20a1 40a2 45a2 50a3 40a4 45a4 60

1 2

a1 10

a1 20

a1 40

a2 45

a2 50

a3 40

a4 45

a4 60

to:

10 20 4045 504045 60

10 20 40

45 50

40

45 60

To create a list of vectors, use split:

split(df1[,2], df1[,1])#$a1#[1] 10 20 40#$a2#[1] 45 50#$a3#[1] 40#$a4#[1] 45 60

split(df1[,2], df1[,1])

#$a1

#[1] 10 20 40

#$a2

#[1] 45 50

#$a3

#[1] 40

#$a4

#[1] 45 60