drop levels in eSet pData
2
1
Entering edit mode
@shamim-sarhadi-9395
Last seen 4.9 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 • 943 views
ADD COMMENT
3
Entering edit mode
@martin-morgan-1513
Last seen 7 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)).

ADD COMMENT
0
Entering edit mode
@shamim-sarhadi-9395
Last seen 4.9 years ago

Great !!

Thank you Mr Martin Morgan

ADD COMMENT

Login before adding your answer.

Traffic: 324 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6