Match a vector to a list of vectors

前端 未结 3 483
情话喂你
情话喂你 2021-01-17 11:35

I have a list of vectors lis which I need to match to another vector vec

lis <- list(c(2,0,0),c(1,1,0), c(1,0,1), c(0,2,0), c(0,         


        
3条回答
  •  一向
    一向 (楼主)
    2021-01-17 11:55

    sapply(lis,function(x)all(x==vec))
    [1] FALSE  TRUE FALSE FALSE FALSE FALSE
    

提交回复
热议问题