Skip to content
Prev 41346 / 63424 Next

array extraction

Somewhat out of my depth here (I have only 2 arms, but am
swimming in waters which require 3): My interpretation is
that a and M are basically vectors, with dimension attributes,
accessed down the columns.

The array 'a' consists of 30 elements 1:30 in that order,
accessed by each of 3 rows for each of 5 columns in each
of two "layers", in that order of precedence.

The matrix M consusts of 15 elements, accessed by each
of 35 rows for each of 5 columns.

Thus a(M) treats M as an selection vector, ignoring dimension,
and reads along a and at the same time along M, selecting
according to TRUE of FALSE. Then, when it gets to the end
of the first "layer" in 'a' it re-cycles M.

When I tried a[M,] I got

  a[M,]
  # Error in a[M, ] : incorrect number of dimensions

I infer that it is treating the M as a vector, so there
are only 2 dimensions in a[M,] instead of 3. So try:

  a[M,,]
  # Error: (subscript) logical subscript too long

which is not surprising since one is applying a 15-long
selector to the first dimension of 'a', which has only
length 3, just as in

  a[rep(TRUE,15),,]
  # Error: (subscript) logical subscript too long

which, interestingly, differs from

  a[rep(1,15),,]
  # (Output, which is what you'd expect, omitted)

(Hmm, out of my depth again ... ).

Well, maybe two arms is not enough when you need three
to swim in these waters; but it seems that one long swishy
tail will do nicely. That being said, I still find the
water quite murky!
Ted.
On 27-Sep-11 22:12:26, robin hankin wrote:
--------------------------------------------------------------------
E-Mail: (Ted Harding) <ted.harding at wlandres.net>
Fax-to-email: +44 (0)870 094 0861
Date: 28-Sep-11                                       Time: 00:28:37
------------------------------ XFMail ------------------------------