I have the following data frame:
df <- structure(list(BoneMarrow = c(30, 0, 0, 31138, 2703), Pulmonar
you can convert rownames to a column and revert back after filtering:
library(dplyr)
library(tibble) # for `rownames_to_column` and `column_to_rownames`
df %>%
rownames_to_column('gene') %>%
filter_if(is.numeric, all_vars(. >= 8)) %>%
column_to_rownames('gene')
# BoneMarrow Pulmonary
# ATP1B1 30 3380
# PRR11 2703 27