[Rd] Base R: applying min/max functions() to character string vectors (PR#9428)

xiao.gang.fan1 at libertysurf.fr xiao.gang.fan1 at libertysurf.fr
Fri Dec 22 16:20:51 CET 2006

Full_Name: Xiao Gang FAN
Version: 2.4.0
OS: Windows XP
Submission from: (NULL) (

Dear All,

This is not really a bug report, but rather a change wish to the Base R
on some functions when applying them to character strings vectors/matrices.

Actually in R, we can do thinks like, the most naturally way in this the world:
> "a" < "b"
[1] TRUE

> order(c("b","a"))
[1] 2 1

> pmax(c("a","b"), c("b"))
[1] "b" "b"

But helas, we can't do things like:
> max(c("a","b"))
Error in max(..., na.rm = na.rm) : invalid 'type' (character) of argument

> range(c("z","b","w","c"))
Error in min(..., na.rm = na.rm) : invalid 'type' (character) of argument

> which.min(c("b","a"))
Warning message:
NAs introduced by coercion 

I hope that you could understand the incoherence exhibited here 
and my wish to see that to be changed some day, say in the becoming 
year 2007. Here's a first list of functions to be reviewed: 
min(), max(), which.min(), which.max(), range(), ...

Best regards and happy holidays to all of you !

More information about the R-devel mailing list