s-news
[Top] [All Lists]

excluding factor levels

To: s-news@lists.biostat.wustl.edu
Subject: excluding factor levels
From: Victor Moreno <v.moreno@ico.scs.es>
Date: Wed, 21 May 2003 13:14:49 +0200
Organization: Institut Català d'Oncologia
Reply-to: v.moreno@ico.scs.es
User-agent: KMail/1.5
Hi,

I have a problem excluding factor levels. 
factor allows an "exclude" argument to avoid some values to form levels:

factor(letters[1:5])
[1] a b c d e
factor(letters[1:5],exclude="b")
[1] a NA c d e

When x already is a factor, this doesn't work:

 x<-factor(letters[1:5])
 factor(x,exclude="b")
[1] a b c d e
Warning messages:
  1 missing values generated coercing from character to integer in: 
storage.mode(exclude) <- storage.mode(levels)

factor converts storage mode  of the exclude argument from character to 
integer, the storage mode for a factor, and the values are lost.
 
-- 
Victor Moreno   
Servei d'Epidemiologia i Registre del Cancer 
Institut Catala d'Oncologia
Gran Via km 2.7, 08907 Hospitalet, Barcelona, Spain
Tel: + 34 93260 7434 / 7401 / 7812    fax +34 93260 7787

<Prev in Thread] Current Thread [Next in Thread>
  • excluding factor levels, Victor Moreno <=