In R, how to transform a matrix wtih 2 columns into a multimap like structure
Posted
by Derek
on Stack Overflow
See other posts from Stack Overflow
or by Derek
Published on 2010-03-19T14:59:19Z
Indexed on
2010/03/19
15:11 UTC
Read the original article
Hit count: 423
Hi,
I am wondering if there is a way to transform a matrix of 2 column into a multimap or list of list.
The first column of the matrix is an id (with possibly duplicated entries) and the 2nd column is some value.
For example, if I have to following matrix
m<-matrix(c(1,2,1,3,2,4), c(3,2))
i would like to transform it into the following list
[[1]]
3,4
[[2]]
2
Thanks,
Derek
© Stack Overflow or respective owner