Skip to content

Unable to specify order of a factor

2 messages · Justin Montemarano, Sarah Goslee

#
Ah, you're missing something crucial:
[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.
chr [1:3] "8" "16" "32"

The factor levels themselves are in the order you specified.
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 <jmontema at kent.edu> wrote: