On 3/5/07, Michael Kubovy <[EMAIL PROTECTED]> wrote:
>
> Unless one makes the factor ordered, reordering the levels of a
> factor does not seem to be a trivial matter. The only R function I've
> found that makes it easy is reorder_factor() (package:reshape). Or am
> I missing something?

Don't think in terms of reordering factors, just create a new factor,
using a call to factor(), with a suitable 'levels' argument. It's
perfectly OK to call factor() on a factor; e.g.

> foo = factor(letters[1:4])
> foo
[1] a b c d
Levels: a b c d
> factor(foo, levels = rev(letters[1:4]))
[1] a b c d
Levels: d c b a

-Deepayan

______________________________________________
[email protected] 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.

Reply via email to