Re: [Rd] sweep sanity checking?

2007-09-02 Thread Martin Maechler
I've been asked to close this thread "in public" > "TH" == Turner, Heather <[EMAIL PROTECTED]> > on Wed, 22 Aug 2007 10:20:21 +0100 writes: TH> Petr Savicky kindly brought this thread to my attention TH> as I'm afraid it had passed me by. As one of the TH> contributors to

Re: [Rd] sweep sanity checking?

2007-08-22 Thread Turner, Heather
tr Savicky Sent: 08 August 2007 07:54 To: r-devel@r-project.org Subject: Re: [Rd] sweep sanity checking? Thanks to Martin Maechler for his comments, advice and for pointing out the speed problem. Thanks also to Ben Bolker for tests of speed, which confirm that for small arrays, a slow down by a

Re: [Rd] sweep sanity checking?

2007-08-07 Thread Petr Savicky
Thanks to Martin Maechler for his comments, advice and for pointing out the speed problem. Thanks also to Ben Bolker for tests of speed, which confirm that for small arrays, a slow down by a factor of about 1.2 - 1.5 may occur. Now, I would like to present a new version of sweep, which is simpler a

Re: [Rd] sweep sanity checking?

2007-07-27 Thread Petr Savicky
When I was preparing the patch of sweep submitted on July 25, I was unaware of the code by Heather Turner. She suggested a very elegant solution, if STATS is a vector and we want to use meaningful recycling in full generality. I would like to suggest a combined solution, which uses Heather Turner's

Re: [Rd] sweep sanity checking?

2007-07-25 Thread Petr Savicky
I would like to suggest a patch against R-devel-2007-07-24, which modifies function sweep by including a warning, if dim(STATS) is not consistent with dim(x)[MARGIN]. If check.margin=FALSE, the simple test whether prod(dim(x)[MARGIN]) is a multiple of length(STATS) is performed. If check.margin=TRU

Re: [Rd] sweep sanity checking?

2007-07-13 Thread Petr Savicky
I would like to suggest a replacement for the curent function sweep based on the two previous suggestions posted at https://stat.ethz.ch/pipermail/r-help/2005-June/073989.html and http://wiki.r-project.org/rwiki/doku.php?id=rdoc:base:sweep with some extensions. My suggestion is to use one of t

Re: [Rd] sweep sanity checking?

2007-07-12 Thread Petr Savicky
I am sorry for an incomplete proposal. The stricter check if (check.margin && any(dims[MARGIN]!=dimstat)) { was meant to be if (check.margin && (length(dimstat)!=length(MARGIN) || any(dims[MARGIN]!=dimstat))) { Petr. __ R-devel@r-project.org

Re: [Rd] sweep sanity checking?

2007-07-12 Thread Robin Hankin
Hi Brian Ripley, Heather Turner, and myself discussed this issue at some length in a thread starting 20 June 2005 (how do folk give a URL that points to a thread?). The consensus was that adding a warning level option to sweep was a good idea; Heather posted a version of sweep that implemented th

Re: [Rd] sweep sanity checking?

2007-07-12 Thread Petr Savicky
The suggestion sounds reasonable to me. Let me add that sweep is written to work even if MARGIN includes more than one dimension. To handle these cases correctly, the test may be replaced e.g. by if (check.margin && prod(dims[MARGIN])!=length(STATS)) { warning("length(STATS) != prod(dim

Re: [Rd] sweep sanity checking?

2007-07-11 Thread Tony Plate
Just an opinion from an R user: I think it's a sound idea. I use my own version of sweep with a stricter check: it stops if the vector is not exactly the right length. -- Tony Plate Ben Bolker wrote: > Ben Bolker zoo.ufl.edu> writes: > > >> What would R-core think of the following 'enhan

Re: [Rd] sweep sanity checking?

2007-07-09 Thread Ben Bolker
Ben Bolker zoo.ufl.edu> writes: > What would R-core think of the following 'enhanced' > sweep? (now posted at http://wiki.r-project.org/rwiki/doku.php?id=rdoc:base:sweep ) It always warns if dim(x)[MARGIN] is > not a multiple of length(STATS) {it's very hard indeed > for me to think of a s

[Rd] sweep sanity checking?

2007-06-29 Thread Ben Bolker
A friend of mine just got bitten by the fact that sweep() will happily sweep out a STATS vector of an arbitrary length -- even one whose length is not a divisor of any of the margins -- without complaining. I know the answer to this could be "well just don't do that", but it's easy to make a mi