I have a matrix that I need to filter by a condition.
yj = y[which(g[,j] == 1),]
A problem arises when "which(g[,j] == 1)" is a 1 (or none) component vector. The output, the aforementioned "yj", is then suddenly a vector. I need to be able to reference it by column. Even if it's a single row, it still needs to be reference-able by column.
How do I make this happen?