How to remove rows with any zero value

前端 未结 8 676
时光取名叫无心
时光取名叫无心 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:52

    You can use filter from dplyr package.

    Let's call your data frame df

    library(dplyr) df1 <- filter(df, Mac1 > 0, Mac2 > 0, Mac3 > 0, Mac4 > 0)

    df1 will have only rows with entries above zero. Hope this helps.

提交回复
热议问题