On Jul 14, 2011, at 11:19 PM, onthetopo wrote:

Hi,

 There are many more patterns than VL to LV.  In fact, too many to be
listed manually.


For example ML should be ordered as LM, QL should be ordered as LQ.
The order is according to the alphabet.

A more complete (reproducible) answer would have been appreciated and note that local custom dictates that context is offered for ongoing threads. Nabble provides a mechanism for doing so.

>lets2 <- paste(LETTERS[sample(20, replace=TRUE)],
                LETTERS[sample(20, replace=TRUE)],
                sep="")
> lets2
[1] "IA" "EP" "TE" "IT" "PS" "DO" "RO" "EJ" "DR" "DD" "LM" "OF" "RJ" "OA" "JD" "QB" "AS" "TG" "MK" "IM"

> sapply( lapply(
                  strsplit(lets2, split=""), sort),
                      paste, collapse="")

[1] "AI" "EP" "ET" "IT" "PS" "DO" "OR" "EJ" "DR" "DD" "LM" "FO" "JR" "AO" "DJ" "BQ" "AS" "GT" "KM" "IM"

--
View this message in context: 
http://r.789695.n4.nabble.com/how-to-order-each-element-according-to-alphabet-tp3668997p3669130.html
Sent from the R help mailing list archive at Nabble.com.

Nabble is NOT rhelp. So PLEASE, PLEASE, PLEASE:

.... do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

--

David Winsemius, MD
West Hartford, CT

______________________________________________
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