I want to filter rows from a data.frame based on a logical condition. Let\'s suppose that I have data frame like
data.frame
expr_value cell_type 1
To select rows according to one 'cell_type' (e.g. 'hesc'), use ==:
==
expr[expr$cell_type == "hesc", ]
To select rows according to two or more different 'cell_type', (e.g. either 'hesc' or 'bj fibroblast'), use %in%:
%in%
expr[expr$cell_type %in% c("hesc", "bj fibroblast"), ]