[R] reverse lexicographic order
Thomas W Blackwell
tblackw at umich.edu
Sun Dec 14 22:45:41 CET 2003
Murray -
If you could guarantee that all of the email addresses have
exactly one occurrence of the "@" character in them, then
something like
spit <- do.call("rbind", strsplit(addresses, "@", FALSE))
will produce a data frame with either two or three character
vectors as the columns, in which user name is a separate
column from the domain name. Now use
spit <- spit[ order(spit[ ,3], spit[ ,1]), ]
to re-sort the data frame by user name within domain name,
and paste() to put the columns back together again.
- tom blackwell - u michigan medical school - ann arbor -
On Mon, 15 Dec 2003, Murray Jorgensen wrote:
> Hi all,
>
> I have some email addresses that I would like to sort in reverse
> lexicographic order so that addresses from the same domain will be
> grouped together. How might that be done?
>
> Murray
>
> --
> Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html
> Department of Statistics, University of Waikato, Hamilton, New Zealand
> Email: maj at waikato.ac.nz Fax 7 838 4155
> Phone +64 7 838 4773 wk +64 7 849 6486 home Mobile 021 1395 862
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
More information about the R-help
mailing list