[R] Creating lists from matrices

Peter Dalgaard p.dalgaard at biostat.ku.dk
Thu Nov 25 10:22:28 CET 2004


Alexander Sokol <alexandersokol at ofir.dk> writes:

> [1] "A" "B" "C"
> [[2]]
> [2] "D" "E" "F"
> [[3]]
> [3] "G" "H" "I"
> 
> That is, each row of the original matrix is turned into a vector and these 
> vectors are collected to a list. How do I do this?

split(my.matrix, row(my.matrix))

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list