How do I create a filtered gene list using expression medians
This below should work. It returns a list,

## example data
j = 5 
M &lt;- matrix(NA,j,j)
M &lt;- sapply(1:j, function(i) `length&lt;-`(1:(j-i+1), j))
rownames(M) &lt;- c("gene1", "gene2", "gene3", "gene4", "gene5")
colnames(M) &lt;- c("cellLine1", "cellLine2", "cellLine3", "cellLine4", "cellLine5")
#####
genelist = apply(M,2,function(i)rownames(M)[which(i&gt;=median(i,na.rm=T))])

####
#you can call the genes for cellline 1 using:
genelist$cellLine1


Hope I got it correct!