Le lun. 5 juil. à 05:56, Martin Maechler a écrit :
>> "PatB" == Patrick Burns
>>on Sun, 04 Jul 2010 09:43:44 +0100 writes:
>
>PatB> Is there a reason that 'which.min' and
>PatB> 'which.max' don't have an 'arr.ind'
>PatB> argument?
>
> well, help(which.min) tells you th
On Tue, Jul 6, 2010 at 11:53 AM, Martin Maechler
wrote:
>
> > "HenrikB" == Henrik Bengtsson
> > on Mon, 5 Jul 2010 22:53:59 +0200 writes:
>
> HenrikB> ...and, of course, just after sending it off I found out that
> from R
> HenrikB> v2.11.0 there is now an arrayInd() in the 'ba
On 06/07/2010 10:53, Martin Maechler wrote:
[ ... ]
Wouldn't it make more sense to call
arrayInd(which.min(mat), dim(mat))
instead of
which.min(mat, arr.ind = TRUE)
in the spirit of modularity, maintainability, ... ?
Honestly, in my first reply I had forgotten about my own
a
> "HenrikB" == Henrik Bengtsson
> on Mon, 5 Jul 2010 22:53:59 +0200 writes:
HenrikB> ...and, of course, just after sending it off I found out that from
R
HenrikB> v2.11.0 there is now an arrayInd() in the 'base' package doing
exactly
HenrikB> the same thing. See help(ar
...and, of course, just after sending it off I found out that from R
v2.11.0 there is now an arrayInd() in the 'base' package doing exactly
the same thing. See help(arrayInd).
/Henrik
On Mon, Jul 5, 2010 at 10:49 PM, hb wrote:
> For what it's worth, see arrayIndex() in R.utils, e.g.
>
> # Singl
For what it's worth, see arrayIndex() in R.utils, e.g.
# Single index
print(arrayIndex(21, dim=c(4,3,3)))
# Multiple indices
print(arrayIndex(20:23, dim=c(4,3,3)))
# Whole array
x <- array(1:30, dim=c(5,6))
print(arrayIndex(1:length(x), dim=dim(x)))
# Find (row,column) of maximum value
m <- dia
On 05/07/2010 10:56, Martin Maechler wrote:
"PatB" == Patrick Burns
on Sun, 04 Jul 2010 09:43:44 +0100 writes:
PatB> Is there a reason that 'which.min' and
PatB> 'which.max' don't have an 'arr.ind'
PatB> argument?
well, help(which.min) tells you that they really were a
> "PatB" == Patrick Burns
> on Sun, 04 Jul 2010 09:43:44 +0100 writes:
PatB> Is there a reason that 'which.min' and
PatB> 'which.max' don't have an 'arr.ind'
PatB> argument?
well, help(which.min) tells you that they really were aimed at
doing their job *fast* for vector
Is there a reason that 'which.min' and
'which.max' don't have an 'arr.ind'
argument?
The context in which I wanted that was
a grid search optimization, which seems
like it would be reasonably common to me.
--
Patrick Burns
pbu...@pburns.seanet.com
http://www.burns-stat.com
(home of 'Some hints