I've got a vector of string
x<-c('a','b')
and I have an matrix with multiple columnsl; which contains names in that vector of string. I would like to get the column numbers/index which matches their names.
which(colnames(sample_matrix) == x)
This above works when x is not a vector but a single element. Any solutions?