We can use == to return a logical vector, and then it can be used to subset strings.
M[rownames(M)=='B00813GRG4',, drop=FALSE]
using "B00813GRG4" because the row index returns only the first matching element, similar to using match .
M[match('B00813GRG4', rownames(M)),, drop=FALSE]
source share