You could do something like that: 

> x <- sample(LETTERS, 10)
> x
 [1] "K" "N" "C" "F" "R" "E" "L" "J" "S" "Q"
> all.equal(order(x), 1:length(x))
[1] "Mean relative  difference: 0.5090909"

When x is a numeric vector, I usually use

> any(diff(x) < 0)

although I don't know whether it's more efficient.

HTH,
Giovanni

> Date: Mon, 03 Nov 2003 16:46:34 +0000
> From: Aurora Torrente <[EMAIL PROTECTED]>
> Sender: [EMAIL PROTECTED]
> Organization: EBI
> Precedence: list
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB;   rv:0.9.4)
>  Gecko/20011128 Netscape6/6.2.1
> 
> Hi all,
> I´m having some trouble when trying to compare character values (to 
> check if they are alphabetically ordered). Is it possible to do it in 
> any way?
> Thanks for your help. Cheers,
> 
>         Aurora
> 
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
> 


-- 

 __________________________________________________
[                                                  ]
[ Giovanni Petris                 [EMAIL PROTECTED] ]
[ Department of Mathematical Sciences              ]
[ University of Arkansas - Fayetteville, AR 72701  ]
[ Ph: (479) 575-6324, 575-8630 (fax)               ]
[ http://definetti.uark.edu/~gpetris/              ]
[__________________________________________________]

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to