[R] problems with max.col()
Martin Maechler
maechler at stat.math.ethz.ch
Thu Apr 24 18:25:52 CEST 2003
The only problem is that in your R installation
?max.col
does (as you say) not give you the help information.
==> problem with your installation only
Because help pages says
>> Details:
>>
>> Ties are broken at random. The determination of ``tie'' assumes
>> that the entries are probabilities: there is a relative tolerance
>> of 1e-5, relative to the largest entry in the row.
and you *do* have ties, hence the result is random.
Regards,
Martin Maechler <maechler at stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
>>>>> "heberto" == heberto ghezzo <g.heberto at lycos.com>
>>>>> on Thu, 24 Apr 2003 12:07:22 -0400 writes:
heberto> Hello, I think the following qualify as a bug
heberto> given:
heberto> x<-c(1,2,3,4,2,4,2,2,4,2,2,2,4,3,2,1)
heberto> z<-embed(x,4)
heberto> z
heberto> [,1] [,2] [,3] [,4]
heberto> [1,] 4 3 2 1
heberto> [2,] 2 4 3 2
heberto> [3,] 4 2 4 3
heberto> [4,] 2 4 2 4
heberto> [5,] 2 2 4 2
heberto> [6,] 4 2 2 4
heberto> [7,] 2 4 2 2
heberto> [8,] 2 2 4 2
heberto> [9,] 2 2 2 4
heberto> [10,] 4 2 2 2
heberto> [11,] 3 4 2 2
heberto> [12,] 2 3 4 2
heberto> [13,] 1 2 3 4
>>
heberto> max.col(z)
heberto> [1] 1 2 3 4 3 1 2 3 4 1 2 3 4
heberto> Why? ^ ^
>> 1 2
heberto> or should be
heberto> [1] 1 2 3 4 3 4 2 3 4 1 2 3 4
heberto> i.e. the first column with the max, or the last column
heberto> same if
heberto> z <- embed(x,5)
heberto> max.col(z)
heberto> [1] 2 1 2 5 1 5 3 4 1 2 3 4
heberto> where it should be either of:
heberto> 2 1 2 3 1 2 3 4 1 2 3 4
heberto> 2 3 4 5 4 5 3 4 5 2 3 4
heberto> or I am missing something?
heberto> ?max.col does not return anything
heberto> R 1.7.0 on Win98
heberto> .
heberto> Heberto.Ghezzo at McGill.ca
heberto> ______________________________________________
heberto> R-help at stat.math.ethz.ch mailing list
heberto> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list