I have a multidimensional array, and I (finally) know I can subset it with a matrix, which has as many columns as there are dimensions in the array. But I need to skip a dimension in the process, to get/set not one element of that dimension, but all of them. How to?
array5d[matrix(c(3,15,2,7,9),1)]
is equivalent to
array5d[3,15,2,7,9]
but what is the matrix-based equivalent of
array5d[ ,15,2,7,9]
The goal here is to be able to subset an array with values of a bunch of vectors, that are generated separately. I don't always need to subset with the first dimension left open, this (or rather, these) changes from case to case. I have a very ugly solution with eval(str2lang(paste0(...))), but I would really like a healthier approach