How to find if ANY column has a specific value I am looking for?

后端 未结 5 560
我在风中等你
我在风中等你 2021-01-18 20:56
   id first  middle  last       Age
    1 Carol  Jenny   Smith      15
    2 Sarah  Carol   Roberts    20
    3 Josh   David   Richardson 22

I am t

5条回答
  •  礼貌的吻别
    2021-01-18 21:31

    A solution using apply family

    df$Carol = lapply(1:nrow(df), function(x) any(df[x,]=="Carol))
    

提交回复
热议问题