Skip to content
Prev 35607 / 63430 Next

order() fails on a chr object of class "AsIs" with "\265" in it

Here's an example (session info at the end).
[1] 2 1
Error in if (xi > xj) 1L else -1L : missing value where TRUE/FALSE needed
[1] 2 1
Class 'AsIs'  chr [1:2] "\265g/L" "Bq/L"
Class 'AsIs'  chr [1:2] "g/L" "Bq/L"

I can easily work around this in my scripts, but shouldn't order() 
succeed with such an object?
(I suppose this could be Mac-specific, but I'm assuming it's not...)

For context:
The character "\265" causes the Greek letter mu to be displayed in 
various output devices. For example, the character vector eventually 
gets written to an html file, which when displayed in Firefox (Mac) 
is displayed as Greek mu. Also in Excel 2004 (Mac).

I first wrote these scripts 6 years ago, when "\265" was a way I 
could find to display the Greek mu in output text files of various 
kinds. They worked as recently as 3 months ago. Maybe there's a 
better way now to display a mu in text-based contexts?
R version 2.10.1 (2009-12-14)
i386-apple-darwin8.11.1

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

Thanks
-Don