Find all rows of matrix equal to vector

后端 未结 2 1740
花落未央
花落未央 2020-12-09 14:17

Suppose I have the following matrix:

cm<-structure(c(100, 200, 400, 800, 100, 200, 400, 800, 100, 200, 
400, 800, 100, 200, 400, 800, 100, 200, 400, 800,          


        
2条回答
  •  [愿得一人]
    2020-12-09 14:46

    The function row.match in prodlim is easy to use, and ideal for your problem.

    library(prodlim)
    row.match(a4[1,], cm[,1:3])
    [1] 1
    

提交回复
热议问题