Displaying 1 result from an estimated 1 matches for "wonderingt".
Did you mean:
wondering
2011 Aug 01
3
General indexing in multidimensional arrays
...p me to supply a logical matrix of the size of the first two dimensions:
indices <- matrix(FALSE,ncol=4,nrow=4)
indices[1,3] <- TRUE
indices[4,1] <- TRUE
result <- data[indices,]
This, however would give me an error. I am used to this kind of indexing
from Matlab and was wonderingt whether there exists an easy way to do
this in R without supplying complicated index matrices of all three
dimensions or logical vectors of the size of the whole matrix?
The only way I could imagine would be to:
result <- data[rep(as.vector(indices),times=4)]
but this seems rather complica...