[R] structure vs. matrix

Edna Bell edna.bell01 at gmail.com
Mon Nov 5 02:32:08 CET 2007


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 <mark_difford at yahoo.co.uk> 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 to do stats (and don't know
> what you are doing --- though I am not suggesting that you don't know how to
> do stats;).
>
> ## see
> ?structure
> ?matrix
>
> A structure is not a matrix.  So, if you want to make a matrix, use
> matrix().  Easy.
>
> HTH,
> Mark.
>
>
> Edna Bell wrote:
> >
> > 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 at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> >
>
> --
> View this message in context: http://www.nabble.com/structure-vs.-matrix-tf4745521.html#a13572508
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list