drop levels in eSet pData
2
1
Entering edit mode
Last seen 6.0 years ago

I have an Eset that containing factors in its pData. When I create a subset of this eSet a new eSet is created. However, the factor variable retains all of its original levels , even when they do not exist in the new eSet , how I could drop this levels?

table(pData(eset)[ ,"Disease"])

these are the levels   : control      node negative breast cancer       node positive breast cancer

but after subseting my eSet dosn't have sample's related to node negative but their level are exist in the data

subsetting eSet • 1.1k views
3
Entering edit mode
@martin-morgan-1513
Last seen 14 days ago
United States

This is the way that subsetting factors works in R, so is expected. One approach to updating is simply to call factor on the column eset$Disease <- factor(eset$Disease).  droplevels has similar functionality, and a data.frame method so pData(eset) = droplevels(pData(eset)).

0
Entering edit mode
Last seen 6.0 years ago

Great !!

Thank you Mr Martin Morgan