Re: [R] Subset: data frames and factor levels

From: Weidong Gu <wgu_at_uab.edu>
Date: Tue, 01 Apr 2008 07:38:05 -0500

Try drop.levels in library gdata.

Weidong Gu,
Department of Medicine
University of Alabama, Birmingham
1900 University Blvd., Birmingham, Alabama 35294 Email: wgu_at_uab.edu
PH: (205)-975-9053

-----Original Message-----
From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] On Behalf Of Agustin Lobo
Sent: Tuesday, April 01, 2008 3:26 AM
To: Stefan Grosse
Cc: r-help_at_r-project.org
Subject: Re: [R] Subset: data frames and factor levels

Thanks, problem solved thanks to your hints, but, within subset(), drop=T still keeps
the unused levels (I'm using 2.6.1 on win). Agus

Stefan Grosse escribió:
> On Tuesday 01 April 2008 09:43:00 am Agustin Lobo wrote:
> AL> I'm doing:
> AL> etni <- subset(etni, NAMECOM!="Maniquisito")
> AL>
> AL> where etni is a data.frame, NAMECOM a factor and "Maniquisito"
labels
> AL> a row that I want to delete.
> AL>
> AL> The problem is that while the row is deleted, the factor level is
still
> AL> there (I can see "Maniquisito" if I do levels(etni$NAMECOM) ).
>
> See
>
http://wiki.r-project.org/rwiki/doku.php?id=tips:data-manip:drop_unused_ levels
>
> Stefan
>
>
>

-- 
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: Agustin.Lobo_at_ija.csic.es
http://www.ija.csic.es/gt/obster

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 01 Apr 2008 - 12:40:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Apr 2008 - 00:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive