Re: [R] structure vs. matrix

2007-11-04 Thread Gabor Grothendieck
In general, you want to use as high level a construct as possible since then the details implementing the construct can be modified and improved without your code changing. This is really just an aspect of modularity. Thus matrix would be preferred. Actually since R allows access to the lower le

Re: [R] structure vs. matrix

2007-11-04 Thread Edna Bell
I was reading "S Programming" and a set of the code used structure to set up a matrix. I just wondered which was better and why. On 11/4/07, Mark Difford <[EMAIL PROTECTED]> wrote: > > Hi Edna, > > >> When creating a matrix, is it better to use the structure function or the > >> matrix function

Re: [R] structure vs. matrix

2007-11-04 Thread Prof Brian Ripley
On Sun, 4 Nov 2007, Duncan Murdoch wrote: > On 04/11/2007 1:28 AM, Edna Bell wrote: >> Hi R Gurus! >> >> When creating a matrix, is it better to use the structure function or >> the matrix function, please? > > I'd use the matrix() function. You can do it with structure(), and your > code might b

Re: [R] structure vs. matrix

2007-11-04 Thread Duncan Murdoch
On 04/11/2007 7:43 AM, Mark Difford wrote: > Hi Edna, > >>> When creating a matrix, is it better to use the structure function or the >>> matrix function...? > > I hope you have a huge (empty) jar in the kitchen, and that your pantry is > empty. > > R isn't too difficult, except if you're trying

Re: [R] structure vs. matrix

2007-11-04 Thread Duncan Murdoch
On 04/11/2007 1:28 AM, Edna Bell wrote: > Hi R Gurus! > > When creating a matrix, is it better to use the structure function or > the matrix function, please? I'd use the matrix() function. You can do it with structure(), and your code might be a little faster, but it will be harder to read, wi

Re: [R] structure vs. matrix

2007-11-04 Thread Mark Difford
Hi Edna, >> When creating a matrix, is it better to use the structure function or the >> matrix function...? I hope you have a huge (empty) jar in the kitchen, and that your pantry is empty. R isn't too difficult, except if you're trying to do stats (and don't know what you are doing --- though

[R] structure vs. matrix

2007-11-03 Thread Edna Bell
Hi R Gurus! When creating a matrix, is it better to use the structure function or the matrix function, please? Thanks, Edna Bell __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://w