Re: [R] Matrix to list

2010-09-03 Thread Henrique Dallazuanna
0.6489858 > > Here you see values of vector with smaller length is getting repeated. > Instead of repetition, I would like to fill those with "NA" (or possibly > some predefined fixed value) > > Would you please suggest me how to do that? > > Thanks, > > >

Re: [R] Matrix to list

2010-09-03 Thread Ron Michael
Fri, 3/9/10, Henrique Dallazuanna wrote: From: Henrique Dallazuanna Subject: Re: [R] Matrix to list To: "Ron Michael" Cc: r-h...@stat.math.ethz.ch Date: Friday, 3 September, 2010, 8:07 PM Try this: unclass(as.data.frame(mat)) On Fri, Sep 3, 2010 at 9:48 AM, Ron Michael wrote: Dear

Re: [R] Matrix to list

2010-09-03 Thread Henrique Dallazuanna
Try this: unclass(as.data.frame(mat)) On Fri, Sep 3, 2010 at 9:48 AM, Ron Michael wrote: > Dear all, suppose I have following matrix: > > > mat <- matrix(rnorm(25), 5) > > > > mat > [,1] [,2][,3] [,4] [,5] > [1,] 0.97056228 -1.3278509 -0.73511792 2.16506

Re: [R] Matrix to list

2010-09-03 Thread Marc Schwartz
On Sep 3, 2010, at 7:48 AM, Ron Michael wrote: > Dear all, suppose I have following matrix: > >> mat <- matrix(rnorm(25), 5) >> >> mat > [,1] [,2][,3] [,4] [,5] > [1,] 0.97056228 -1.3278509 -0.73511792 2.1650629 -0.4411997 > [2,] 0.58613700 -0.2559899 -1

Re: [R] Matrix to list object

2009-12-28 Thread Henrique Dallazuanna
Try this: mat_list <- lapply(split(mat, seq(nrow(mat))), matrix, ncol = 3) On Mon, Dec 28, 2009 at 9:20 AM, Ron_M wrote: > > let consider following matrix : > > mat <- matrix(rnorm(45), 15) > > Now I want  to convert it to a list object "mat_list", which will have 15 > elements and each element

Re: [R] matrix to list

2008-09-18 Thread Henrique Dallazuanna
Try this: m <- matrix(rep(1:3, 3), 3, dimnames = list(letters[1:3], letters[1:3])) as.data.frame.table(t(m)) On Wed, Sep 17, 2008 at 10:52 PM, Pinder, Adrian <[EMAIL PROTECTED]> wrote: > Hi, can someone please tell me how to convert a square matrix to a list in R? > > i.e. I want to convert from:

Re: [R] matrix to list

2008-09-17 Thread hadley wickham
On Wed, Sep 17, 2008 at 8:52 PM, Pinder, Adrian <[EMAIL PROTECTED]> wrote: > Hi, can someone please tell me how to convert a square matrix to a list in R? > > i.e. I want to convert from: > >a b c > a 1 1 1 > b 2 2 2 > c 3 3