[R] structure vs. matrix
Duncan Murdoch
murdoch at stats.uwo.ca
Sun Nov 4 15:18:13 CET 2007
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, will break
if someone ever changes the low-level implementation of matrices, e.g.
by replacing it with the Matrix class.
Duncan Murdoch
More information about the R-help
mailing list