Re: [R] extracting the levels of a subset of data

2003-09-19 Thread Philipp Pagel
Hi! tmpdata-subset(myd, TYPE==A) levels(tmpdata$TYPE) [1] A B C I'd like to get only A as output... rebuild the factor after subsetting: tmpdata$TYPE - factor(tmp$TYPE) If you want the levels of all factors in your data frame to be adjusted you could also use: tmpdata -

RE: [R] extracting the levels of a subset of data

2003-09-19 Thread Jesus Frias
Hiya I'd like to get only A as output... two solutions: 1.-use unique() unique(tempdata$TYPE) to get your answer 2.-or call factor again to reduce the levels: tmpd - subset(myd,clas==A) levels(tmpd$clas) [1] A B C tmpd$clas - factor(tmpd$clas) levels(tmpd$clas) [1] A regards,