| To: | s-news@lists.biostat.wustl.edu, Mark.Hearnden@nt.gov.au |
|---|---|
| Subject: | Re: Removing levels from a factor |
| From: | Terry Therneau <therneau@mayo.edu> |
| Date: | Wed, 5 Mar 2008 08:05:01 -0600 (CST) |
| Reply-to: | Terry Therneau <therneau@mayo.edu> |
The easiest thing is to turn off factors:
> options(stringsAsFactors=F)
> data$Treatment <- as.character(data$Treatment)
Now you can subset the data frame and things will work as you would anticipate.
Comment: factors are occassionaly useful, but only occasionally. Much grief
can be avoided by turning them off by default. Our biostat group (>100 people,
over 1200 projects a year) has had the above option as a part of our global
defaults for many years, and has not yet seen a downside to the decision.
Terry Therneau
Mayo Clinic
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Constrained regression, Carlos Alzola |
|---|---|
| Next by Date: | Re: Execution speed with factors (was: Removing levels from a factor), Alan Hochberg |
| Previous by Thread: | RE Removing levels from a factor, gerald . jean |
| Next by Thread: | Re: Execution speed with factors (was: Removing levels from a factor), Alan Hochberg |
| Indexes: | [Date] [Thread] [Top] [All Lists] |