Yao, Minghua
2004-Aug-25 19:20 UTC
[R] How to Arrange character vector in alphabetic order
Hi, Is there any function that can arrange a character in alphabetic order? Thanks for answer -MY [[alternative HTML version deleted]]
You mean as in:> x <- c("aaa", "abc", "ab", "d") > sort(x)[1] "aaa" "ab" "abc" "d" ?? Andy> From: Yao, Minghua > > Hi, > > Is there any function that can arrange a character in > alphabetic order? Thanks for answer > > -MY
> Is there any function that can arrange a character in alphabetic order? Thanks for answerCheck out sort().> vv <- c(letters[5:10], letters[20:11], letters[21:26], letters[4:1]) > vv[1] "e" "f" "g" "h" "i" "j" "t" "s" "r" "q" "p" "o" "n" "m" "l" "k" "u" "v" "w"[20] "x" "y" "z" "d" "c" "b" "a"> sort(vv)[1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"[20] "t" "u" "v" "w" "x" "y" "z"
Sundar Dorai-Raj
2004-Aug-25 19:38 UTC
[R] How to Arrange character vector in alphabetic order
Yao, Minghua wrote:> Hi, > > Is there any function that can arrange a character in alphabetic order? Thanks for answer > > -MY > > [[alternative HTML version deleted]] > > ______________________________________________ > 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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ?sort, ?order, etc.... --sundar
Yao, Minghua
2004-Aug-25 19:38 UTC
[R] RE: How to Arrange character vector in alphabetic order
Sorry for not asking the question clearly. The elements of the character vector may consist of numbers not just letter. How to do that. Thanks. -MY ________________________________ From: Yao, Minghua Sent: Wed 8/25/2004 2:20 PM To: R Help Subject: How to Arrange character vector in alphabetic order Hi, Is there any function that can arrange a character in alphabetic order? Thanks for answer -MY [[alternative HTML version deleted]]
Liaw, Andy
2004-Aug-25 20:17 UTC
[R] RE: How to Arrange character vector in alphabetic order
Please do read the posting guide, which suggests that you provide a simple example of what you want to achieve, instead of leaving people guessing what you have in mind. Andy> From: Yao, Minghua > > Sorry for not asking the question clearly. The elements of > the character vector may consist of numbers not just letter. > How to do that. Thanks. > > -MY > > ________________________________ > > From: Yao, Minghua > Sent: Wed 8/25/2004 2:20 PM > To: R Help > Subject: How to Arrange character vector in alphabetic order > > > Hi, > > Is there any function that can arrange a character in > alphabetic order? Thanks for answer > > -MY > ______________________________________________ > 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 > >