[Rd] Base R: applying min/max functions() to character string vectors (PR#9428)
murdoch at stats.uwo.ca
Fri Dec 22 17:08:44 CET 2006
On 12/22/2006 10:20 AM, xiao.gang.fan1 at libertysurf.fr wrote:
> Full_Name: Xiao Gang FAN
> Version: 2.4.0
> OS: Windows XP
> Submission from: (NULL) (126.96.36.199)
> 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"
>  TRUE
>  2 1
>> pmax(c("a","b"), c("b"))
>  "b" "b"
> But helas, we can't do things like:
> Error in max(..., na.rm = na.rm) : invalid 'type' (character) of argument
> Error in min(..., na.rm = na.rm) : invalid 'type' (character) of argument
> 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(), ...
That does seem like a reasonable change. Why not submit a patch? min
and max are in https://svn.r-project.org/R/trunk/src/main/summary.c. I
haven't looked up the others, but it's possible they just call the
internal code for min and max.
More information about the R-devel