Hoi Agustin,
--On woensdag 15 oktober 2003 18:47 +0200 Agustin Lobo [EMAIL PROTECTED]
wrote:
Could anyone suggest the way of subseting
the 3D array to get a vector of z values
for each position recorded in ib5km.lincol.random?
(avoiding the use of for loops).
Is section 5.3 from the
One way would be:
apply(ib5km.lincol.random[1:3,], 1, function(i) ib5km15.dbc[i[1],i[2],])
(untested)
-- Tony Plate
At Wednesday 06:47 PM 10/15/2003 +0200, Agustin Lobo wrote:
Hi!
I have a 3d array:
dim(ib5km15.dbc)
[1] 190 241 19
and a set of positions to extract:
That does use a for loop inside apply.
I would make use of dim shuffling: you have an array indexed by (x,y,z)
and you want (I presume) a matrix indexed by ((x,y), z) for specified
pairs (x,y).
X - ib5km15.dbc
dim(X) - c(190*241, 19)
X[ib5km.lincol.random %*% c(1, 240) - 240, ]
should be