Sorting strings
On Mon, Feb 20, 2012 at 05:55:30AM -0800, statquant2 wrote:
I did, but this does not give the answer to my question... Anybody knows how to tweack the behaviour of sort or how to do ?
Hi.
Try this
Sys.setlocale("LC_COLLATE", "C")
This comes from ?locale and reads there
Sys.setlocale("LC_COLLATE", "C") # turn off locale-specific sorting,
# usually
See also ?sort
The sort order for character vectors will depend on the collating
sequence of the locale in use: see ?Comparison?.
?Comparison
Comparison of strings in character vectors is lexicographic within
the strings using the collating sequence of the locale in use: see
?locales?. The collating sequence of locales such as ?en_US? is
normally different from ?C? (which should use ASCII) and can be
surprising. Beware of making _any_ assumptions about the
collation order: ...
Hope this helps.
Petr Savicky.