--- Begin Message ---
- To: Bill.Venables_AT_csiro.au
- Subject: Re: [R] reduce levels
- From: Claus Atzenbeck <>
- Date: Tue, 8 Nov 2005 18:10:02 +0100 (CET)
- Cc: R-help <>
- In-reply-to: <>
- List-archive: <>
- List-help: <>
- List-id: "Main R Mailing List: Primary help" <>
- List-post: <>
- List-subscribe: <>
- List-unsubscribe: <>
- References: <>
- Sender: r-help-bounces_AT_stat.math.ethz.ch
On Tue, 8 Nov 2005 Bill.Venables_AT_csiro.au wrote:
> sub$mm <- factor(sub$mm)
Great. This is exactly what I need.
> is the simplest way to change a single factor in this way. To do a
> whole data frame you just need a loop:
>
> drop_unused_levels <- function(data)
> as.data.frame(lapply(data, function(x) if(is.factor(x))
> factor(x) else x ))
Thanks for this additional information. Maybe I'll be in need of it
later.
Greetings,
Claus
______________________________________________
R-help_AT_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--- End Message ---