How to remove rows with any zero value

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

    I would do the following.

    Set the zero to NA.

     data[data==0] <- NA
     data
    

    Delete the rows associated with NA.

     data2<-data[complete.cases(data),]
    

提交回复
热议问题