Of course the reasoning below applies also to an example with which.max,
so yet another suggestion for the x vector: x <- c(1, 2, 0, 0, 3, 3, 1, 2)
> which.min(x)
[1] 3
> which(x == min(x))
[1] 3 4
> which.max(x)
[1] 5
> which(x == max(x))
[1] 5 6
Cheers,
Henrik
On 08.10.2011 14:54, Henrik Pärn wrote:> Dear R developers,
>
> I find the which.min function very handy. However, maybe you could
> consider a tiny addition to the example data in the the help text.
>
> By adding another zero to the vector x...
>
> x <- c(1:4, 0, 0:5,11)
>
> ...the example would more explicitly show that which.min actually
> 'giv[es] the index of the /first/ minimum or maximum respectively of
> x'. This will also more clearly distinguish it from which(x == min(x))
> that is mentioned in the text.
> which.min(x)
> [1] 5
> > which(x == min(x))
> [1] 5 6
>
> The 'first' is emphasized by italics in the Value section, while it
is
> parenthesized in Description. I believe that the parenthesis could be
> removed, and 'first' possibly could be emphasized here as well.
>
>
> Well, well, just a small suggestion. Thank you all for your great work.
>
> Best regards,
>
> Henrik
>
> --
> Henrik Pärn
> Centre for Conservation Biology
> Department of Biology
> Norwegian University of Science and Technology
> NO-7491 Trondheim
> NORWAY
>
> Office: +47 735 96084
> Mobile: +47 909 89 255
> Fax: +47 735 96100
--
Henrik Pärn
Centre for Conservation Biology
Department of Biology
Norwegian University of Science and Technology
NO-7491 Trondheim
NORWAY
Office: +47 735 96084
Mobile: +47 909 89 255
Fax: +47 735 96100
[[alternative HTML version deleted]]