PROTECTED] On Behalf Of Andrew Yee
Sent: Wednesday, 18 June 2008 4:22 p.m.
To: r-help@r-project.org
Subject: [R] keeping original order in factor()
Apologies for the naieveness of this question, but I'm having
trouble figuring out to have factor() maintain original ordering.
For example,
foo <-
;> [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Yee
>> Sent: Wednesday, 18 June 2008 4:22 p.m.
>> To: r-help@r-project.org
>> Subject: [R] keeping original order in factor()
>>
>> Apologies for the naieveness of this question, but I'm having
>> troubl
ee
> Sent: Wednesday, 18 June 2008 4:22 p.m.
> To: r-help@r-project.org
> Subject: [R] keeping original order in factor()
>
> Apologies for the naieveness of this question, but I'm having
> trouble figuring out to have factor() maintain original ordering.
>
> For e
; "k" "m" "w"
> bar <- factor(foo, levels = unique(foo))
> bar
[1] i j u f a k m k i w
Levels: i j u f a k m w
>
Is this what you are trying to do?
HTH
Steve McKinney
-Original Message-
From: [EMAIL PROTECTED] on behalf of Andrew Yee
Sent: T
Apologies for the naieveness of this question, but I'm having trouble
figuring out to have factor() maintain original ordering.
For example,
foo <- c("b","b","a","a")
levels(factor(foo, ordered=T)) #I'd like this to return as "b" "a"
#not "a" "b"
I thoug
5 matches
Mail list logo