[Rd] 'max' on mixed numeric and character arguments

Suharto Anggono Suharto Anggono suharto_anggono at yahoo.com
Sat Oct 8 16:42:46 CEST 2016


Bug 17160 (https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17160) leads me to ask this. In R, should max(...) equals max(c(...)) ? If 'max' have both numeric and character arguments, should lexicographic sorting be used for all?

> max("", 3, 10)
[1] "3"
> max("", c(3, 10))
[1] "10"
> range("", c(3, 10))[2]
[1] "3"

Should all above have the same result?

> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows XP (build 2600) Service Pack 2

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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



More information about the R-devel mailing list