[R] 3 dimensional matrix??
Jason Turner
jasont at indigoindustrial.co.nz
Fri Jun 15 03:42:12 CEST 2001
> Perhaps this is obvious...but is there anyway to create a matrix like
> object with has more than 2 dimensions.
Yes. They're called arrays in R.
my.array<-array(0,dim=c(10,5,6,8))
will give you a 4-dimensional 10 x 5 x 6 x 8 array.
Have a look at the source for "spectrum" in the ts library
for a good example of their use.
> I want to estimate a bunch
> of var/cov matrices inside an index loop. It would be more
> computationally efficient to do this in C...but R makes many of the
> operations inside the loop really easy!
You can, of course, migrate the innermost portions of the loop
out to C or Fortran after polishing it in R. And yes, R makes it much
easier. Debugging pointers in variable-sized 4-d arrays isn't
my idea of a good time. ;-)
Cheers
Jason
--
Indigo Industrial Controls Ltd.
64-21-343-545
jasont at indigoindustrial.co.nz
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list