Ah, you're missing something crucial:

> levels(total.density)
[1] "8"  "16" "32"

is giving you the *labels* of the factor, as *strings*, and what you
get if you use order() on them has nothing to do with the order of the
factor levels, and everything to do with the string sort order for
your locale.

> str(levels(total.density))
 chr [1:3] "8" "16" "32"

The factor levels themselves are in the order you specified.

> str(total.density)
 Ord.factor w/ 3 levels "8"<"16"<"32": 1 1 1 1 1 1 1 1 1 1 ...




On Wed, Mar 21, 2012 at 10:50 AM, Justin Montemarano <jmont...@kent.edu> wrote:
> Actually I've try that too, Sarah....
>
> The test is to run order(levels(total.density)), which I need to be 1 2 3,
> not 2 3 1, and your solution still gives me 2 3 1.
>
> I also don't know how to reply to this thread with the previous message
> below...
> -
> Justin Montemarano
> Graduate Student
> Kent State University - Biological Sciences
>

-- 
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
R-help@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.

Reply via email to