Constructs and evaluates an expression to do the requested indexing.
E.g., for x with length(dim(x))==4 the call
asub(x, list(c("a","b"), 3:5), 2:3) will construct and evaluate
the expression x[, c("a","b"), 3:5, ], and the call
asub(x, 1, 2, drop=FALSE) will construct and evaluate
the expression x[, 1, , , drop=FALSE].
asub checks that the elements of dims are in the range 1
to length(dim(x)) (in the case that x is a vector,
length(x) is used for dim(x)). Other than that, no
checks are made on the suitability of components of idx as
indices for x. If the components of idx have any
out-of-range values or unsuitable types, this will be left to the
subsetting method for x to catch.