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
The reason expr[expr[2] == 'hesc'] doesn't work is that for a data frame, x[y] selects columns, not rows. If you want to select rows, change to the syntax x[y,] instead:
expr[expr[2] == 'hesc']
x[y]
x[y,]
> expr[expr[2] == 'hesc',] expr_value cell_type 4 5.929771 hesc 5 5.873096 hesc 6 5.665857 hesc