Skip to content

minor error in documentation of pmax in base (PR#2513)

2 messages · Liaw, Andy, Jonathan Baron

#
If I'm not mistaken, matrices and arrays are just vectors with dim
attribute.  so I'm not surprised that pmax and pmin work as they do.  You
get the same answer by the following:

array(pmax(1:24, 24:1), c(2, 3, 4))
array(pmin(1:24, 24:1), c(2, 3, 4))


Cheers,
Andy
------------------------------------------------------------------------------
#
In a way it is not surprising, but some functions that operate on
vectors will coerce their outputs into vectors and others won't.
For example, try

m1 <- array(1:24,c(2,3,4))
sort(m1)
order(m1)

It would be nice to say when each of these things will happen.

For example, in the documentaition for ifelse, it says, "returns
a value with the same shape as".  This sort of language would be
helpful.

Jon
On 01/31/03 12:42, Liaw, Andy wrote: