Re: [R] expand.grid applied to a matrix

2009-12-16 Thread Jean-Christophe Domenge
Many thanks for both replying and fixing the typo! jc On Tue, Dec 15, 2009 at 21:20, Charles C. Berry wrote: > On Tue, 15 Dec 2009, Jean-Christophe Domenge wrote: > > Dear R gurus, >> I'm looking for a way to expand a matrix to a data frame as detailed >> below: >> given a Matrix M with attribu

Re: [R] expand.grid applied to a matrix

2009-12-15 Thread Charles C. Berry
On Tue, 15 Dec 2009, Jean-Christophe Domenge wrote: Dear R gurus, I'm looking for a way to expand a matrix to a data frame as detailed below: given a Matrix M with attribute dimnames=list(c("a","b"),c("u","v")), return a data frame df.M with df.M$row df.M$col df.M$val "a""u"

[R] expand.grid applied to a matrix

2009-12-15 Thread Jean-Christophe Domenge
Dear R gurus, I'm looking for a way to expand a matrix to a data frame as detailed below: given a Matrix M with attribute dimnames=list(c("a","b"),c("u","v")), return a data frame df.M with df.M$row df.M$col df.M$val "a""u" M["a","u"] "b""v" M["b". "v