[R] Fwd: Arrays of variable dimensionality

WRAY NICHOLAS nicholas.wray at ntlworld.com
Sun May 31 16:01:00 CEST 2015


Thanks for all the ideas   I will run through them next week when I'm back
at work... Nick
---------- Forwarded message ----------
From: WRAY NICHOLAS <nicholas.wray at ntlworld.com>
Date: 30 May 2015 at 11:29
Subject: Arrays of variable dimensionality
To: r-help <r-help at r-project.org>


Hello folks

Supposing I have a multidimensional array in an R prog, say a 4D array.

I want the coordinate quantities to be read off from a vector.  The values
in the vector (vec) are generated by a function.

This is easy if the number of dimensions is fixed for both the array and
the number of elements in the  vector (say 4):

X<-array[vec[1],vec[2],vec[3],vec[4]]

But if the number of dimensions of the array is not fixed and can change
during the course of the prog I am stuck as to how to do this, as I don’t
know a way of feeding a vector or list of unspecified beforehand length
into the coordinates for an array

I can’t find anything useful about this on the net

Does anyone have any ideas?
Thanks, Nick

	[[alternative HTML version deleted]]



More information about the R-help mailing list