Re: [R] Levels in returned data.frame after subset

2010-09-05 Thread Ulrik Stervbo
Thanks for the replies! Obviously I must have used to wrong search terms - sorry. @greg: I care about the levels after the subset, because if they are not dropped, then they still appear in the subsequent heatmap I make with ggplot (with my read data-set of course). Admittedly I am quite green, a

Re: [R] Levels in returned data.frame after subset

2010-09-04 Thread Greg Snow
ginal Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Ulrik Stervbo > Sent: Saturday, September 04, 2010 6:53 AM > To: r-help@r-project.org > Subject: [R] Levels in returned data.frame after subset > > Dear List, > >

Re: [R] Levels in returned data.frame after subset

2010-09-04 Thread Ista Zahn
Hi Ulrik On Sat, Sep 4, 2010 at 12:52 PM, Ulrik Stervbo wrote: > Dear List, > > When I subset a data.frame, the levels are not re-adjusted (see > example). Why is this? Am I missing out on some basic stuff here? Only that this issue has come up many times before, and that this list is archived a

[R] Levels in returned data.frame after subset

2010-09-04 Thread Ulrik Stervbo
Dear List, When I subset a data.frame, the levels are not re-adjusted (see example). Why is this? Am I missing out on some basic stuff here? Thanks Ulrik > m <- data.frame(gender = c("M", "M","F"), ht = c(172, 186.5, 165), wt = > c(91,99, 74)) > dim(m) [1] 3 3 > levels(m$gender) [1] "F" "M"