Le 03.02.2005 16:42, Romain Francois a �crit :

Hello,

try the following :

l <- list(NULL)
l[[1]] <- 1:2
l[[2]] <- 2:3
l[[3]] <- 4:5
l

[[1]] [1] 1 2

[[2]]
[1] 2 3

[[3]]
[1] 4 5

matrix(unlist(l),ncol=2)

Sorry, i forgot the byrow argument, the correct comand was :

matrix(unlist(l),ncol=2,byrow=T)

I need some coffee. :-)

Romain

    [,1] [,2]
[1,]    1    3
[2,]    2    4
[3,]    2    5


Is that what you want ?

Romain
Le 03.02.2005 16:08, michael watson (IAH-C) a �crit :

Hi

Sorry to ask such a basic question.  I have a list, each element of
which is a vector of two values.  What I actually want is a matrix with
two columns, and one row per element of the list.  Obviously I have
tried as.matrix(), and as.vector() but I didn't expect the latter to
work.

I feel so lame asking this.  Any suggestions?

Mick






--
Romain FRANCOIS : [EMAIL PROTECTED]
page web : http://addictedtor.free.fr/  (en construction)
06 18 39 14 69 / 01 46 80 65 60
_______________________________________________________
Etudiant en 3eme ann�e
Institut de Statistique de l'Universit� de Paris (ISUP)
Fili�re Industrie et Services
http://www.isup.cicrp.jussieu.fr/

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to