RE: [Rd] Reorganization of packages in the R distribution

2003-12-18 Thread Prof Brian Ripley
The short answer is no: there is no supported way to override an R system 
function.  The only reason we can see to do that is to correct a bug, and 
we would prefer to get the buggy original changed ASAP.

It is much preferable for package authors to name variant versions
differently: if any 1 is allowed to masquerade, then N > 1 can do so too
and their versions will conflict.

However, if you wish to engage in this activity, the way you do it is
almost as good as any.  In these days of namespaces, something like

lowess.default <- stats::lowess

is needed, so

lowess.default <-
   if(R.version$major == 1 && R.version$minor < 9) base::lowess
   else stats::lowess

looks about right (since I suspect your code is not intended for R <
1.6.0).

Nevertheless, be aware that there is no guarantee that users will get your 
version because of the namespace scoping rules.


On Tue, 16 Dec 2003, Warnes, Gregory R wrote:

> 
> Ok, to take this thread in a slightly different direction.  In my 'gregmisc'
> package I redefine the R code 'lowess' function 
> by moving the existing 'lowess' to 'lowess.default' and making 'lowess' a
> generic. 
> 
> Is there a "proper" and "supported" way of accomplishing this task?
> 
> [Please ignore for the moment whether this is appropriate for the lowess
> function.  That is a separate discussion.]

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


[Rd] a debugging difficulty

2003-12-18 Thread Patrick Burns
I had an error to debug that turned out to be essentially:

> NULL * matrix(1:4, 2)
Error: dim<- length of dims do not match the length of object
The equivalent of the NULL was a variable that was meant
to be a scalar.  It took me a while to track down the problem
because I was focusing on looking for arrays that were different
than my expectation.
I think it could save substantial debugging time if the error message
stated the dims and the length of the object.
Also with

options(error=dump.frames)

set before the command above, we get:

> debugger()
Message:  Error: dim<- length of dims do not match the length of object
Available environments had calls:
1:
0:
Enter an environment number, or 0 to exit  Selection: 1
Selection: 0
>
That is, there is apparently an environment to select, but
trying to select it doesn't do anything.
This is with R version 1.8.1 on Windows and SuSe 8.2 (both precompiled).

Patrick Burns

Burns Statistics
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


[Rd] qbinom when probability is 1 (PR#5900)

2003-12-18 Thread jonathan-cran
Full_Name: Jonathan Swinton
Version: 1.8.0
OS: Windows 2000
Submission from: (NULL) (193.132.159.34)


Calling qbinom with a sample probability of 1 returns NaN
> qbinom(p=0.95,size=10,prob=1)
[1] NaN

I believe that this is wrong and that qbinom(p,size,prob=1) should always be
size for 0=
 p, where F is the distribution function. 



Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = 
 major = 1
 minor = 8.0
 year = 2003
 month = 10
 day = 08
 language = R

Windows 2000 Professional (build 2195) Service Pack 3.0

Search Path:
 .GlobalEnv, package:lattice, package:Hmisc, package:XML, package:graph,
package:methods, package:ctest, package:mva, package:modreg, package:nls,
package:ts, Autoloads, package:base

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] a debugging difficulty

2003-12-18 Thread Prof Brian Ripley
The error message is easy to expand, and R is a bit inconsistent as we do 
have

  error("length of dimnames[%d] not equal to array extent",i+1);

I've seen similar things debugging recently, and don't know the cause.

On Thu, 18 Dec 2003, Patrick Burns wrote:

> I had an error to debug that turned out to be essentially:
> 
>  > NULL * matrix(1:4, 2)
> Error: dim<- length of dims do not match the length of object
> 
> 
> The equivalent of the NULL was a variable that was meant
> to be a scalar.  It took me a while to track down the problem
> because I was focusing on looking for arrays that were different
> than my expectation.
> 
> I think it could save substantial debugging time if the error message
> stated the dims and the length of the object.
> 
> Also with
> 
> options(error=dump.frames)
> 
> set before the command above, we get:
> 
>  > debugger()
> Message:  Error: dim<- length of dims do not match the length of object
> Available environments had calls:
> 1:
> 0:
> 
> Enter an environment number, or 0 to exit  Selection: 1
> Selection: 0
>  >
> 
> That is, there is apparently an environment to select, but
> trying to select it doesn't do anything.
> 
> This is with R version 1.8.1 on Windows and SuSe 8.2 (both precompiled).
> 
> 
> Patrick Burns
> 
> Burns Statistics
> [EMAIL PROTECTED]
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of S Poetry and "A Guide for the Unwilling S User")
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
> 
> 

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] qbinom when probability is 1 (PR#5900)

2003-12-18 Thread Prof Brian Ripley
The cases of prob=0 and prob=1 were specifically excluded in the code,
as well as n=0.  I've added special-case code for all of these.

On Thu, 18 Dec 2003 [EMAIL PROTECTED] wrote:

> Full_Name: Jonathan Swinton
> Version: 1.8.0
> OS: Windows 2000
> Submission from: (NULL) (193.132.159.34)
> 
> 
> Calling qbinom with a sample probability of 1 returns NaN
> > qbinom(p=0.95,size=10,prob=1)
> [1] NaN
> 
> I believe that this is wrong and that qbinom(p,size,prob=1) should always be
> size for 0 
> The documentation says that 
> 
>  The quantile is defined as the smallest value x such that F(x) >=
>  p, where F is the distribution function. 
> 
> 
> 
> Version:
>  platform = i386-pc-mingw32
>  arch = i386
>  os = mingw32
>  system = i386, mingw32
>  status = 
>  major = 1
>  minor = 8.0
>  year = 2003
>  month = 10
>  day = 08
>  language = R
> 
> Windows 2000 Professional (build 2195) Service Pack 3.0
> 
> Search Path:
>  .GlobalEnv, package:lattice, package:Hmisc, package:XML, package:graph,
> package:methods, package:ctest, package:mva, package:modreg, package:nls,
> package:ts, Autoloads, package:base
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
> 
> 

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


[Rd] Re: [R] R GUI dies using postcript() in Windows XP Pro (PR#5910)

2003-12-18 Thread dmurdoch
On Thu, 18 Dec 2003 18:02:07 +, Gavin Simpson
<[EMAIL PROTECTED]> wrote :

>Dear List,
>
>My colleague has been having a problem with the following data and 
>plotting commands. The example below is part of a larger set of plots, 
>but I've isolated the problem to this example using this small dataset 
>(below), which kills rgui consistently. My version info
>
> > version
>  _
>platform i386-pc-mingw32
>arch i386
>os   mingw32
>system   i386, mingw32
>status
>major1
>minor8.0
>year 2003
>month10
>day  08
>language R
>
>But this also happens in 1.8.1 on Windows XP Pro

I just tried it in 1.8.1, Win XP Pro, with no error, then tried in a
relatively recent build of r-patched and saw the crash.  I'll see if I
can track it down.

Duncan Murdoch
>
>The code seems to stop at the call to plot() in the code below, and then 
>MS's error reporting window pops up and informs us that rgui has been 
>closed.
>
>Note that the same code, but without the postcript() and dev.off() 
>commands works as expected to produce the plot on a windows device.
>
>Any ideas as to what is going on?
>
>All the best,
>
>Gav
>
>#code to run to reproduce the problem
>year <- c(1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 
>1998, 1999, 2000, 2001, 2002)
>
>avgMsr <- c(10.80, 7.00, 6.20, 9.571429, 10.80, 
>11.60, 10.20, 11.40, 7.20, 9.40, 11.20, 
>11.60, 11.60, 8.00, 7.60)
>
>totMsr <- c(19, 17, 13, 24, 17, 17, 21, 18, 13, 15, 19, 18, 21, 15, 11)
>
>postscript(file="invert.eps", onefile=FALSE, horizontal = FALSE, 
>pointsize = 8)
>
>op <- par(mar = c(3,4,1.5,1)+0.1,font.main=16,tcl=-0.2)
>plot(x = year, y = avgMsr, ylab = "Species richness", main = "Loch Coire 
>nan Arr", axes = FALSE, ylim = c(0,25), xlim = c(1988,2002))
>axis(2, las=1)
>axis(1)
>lines(x = year, y = avgMsr)
>points(x = year, y = totMsr , col = "black", pch = 19, type = "o")
>lines(x = year, y = totMsr)
>box()
>par(op)
>dev.off()

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel