Filter data.frame rows by a logical condition

前端 未结 9 1372
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-21 05:43

I want to filter rows from a data.frame based on a logical condition. Let\'s suppose that I have data frame like

   expr_value     cell_type
1           


        
9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-21 05:54

    Use subset (for interactive use)

    subset(expr, cell_type == "hesc")
    subset(expr, cell_type %in% c("bj fibroblast", "hesc"))
    

    or better dplyr::filter()

    filter(expr, cell_type %in% c("bj fibroblast", "hesc"))
    

提交回复
热议问题