How to preserve base data frame rownames upon filtering in dplyr chain

前端 未结 4 2003
梦如初夏
梦如初夏 2020-12-05 02:22

I have the following data frame:


df <- structure(list(BoneMarrow = c(30, 0, 0, 31138, 2703), Pulmonar         


        
4条回答
  •  既然无缘
    2020-12-05 02:41

    How about try this by using base R Boolean

    df[rowSums(df>8)==dim(df)[2],] 
    
           BoneMarrow Pulmonary
    ATP1B1         30      3380
    PRR11        2703        27
    

    EDIT1: Or you can do df[!rowSums(df<8),] (as per @user20650) will give back you same result.

提交回复
热议问题