How to remove rows with any zero value

前端 未结 8 670
时光取名叫无心
时光取名叫无心 2020-11-28 07:04

I have a problem to solve how to remove rows with a Zero value in R. In others hand, I can use na.omit() to delete all the NA values or use complete.cases

8条回答
  •  孤独总比滥情好
    2020-11-28 07:54

    I prefer a simple adaptation of csgillespie's method, foregoing the need of a function definition:

    d[apply(d!=0, 1, all),]
    

    where d is your data frame.

提交回复
热议问题