Re: S Compatibility (Was: Re: R-beta: 'all.names' function -- failing as.list( _function_ ))

Thomas Lumley (thomas@biostat.washington.edu)
Tue, 29 Apr 1997 16:28:55 -0700 (PDT)


Date: Tue, 29 Apr 1997 16:28:55 -0700 (PDT)
From: Thomas Lumley <thomas@biostat.washington.edu>
To: Ross Ihaka <ihaka@stat.auckland.ac.nz>
Subject: Re: S Compatibility (Was: Re: R-beta: 'all.names' function -- failing   as.list( _function_ ))
In-Reply-To: <199704292313.LAA04791@stat1.stat.auckland.ac.nz>

On Wed, 30 Apr 1997, Ross Ihaka wrote:
> 
> Some things we almost certainly won't be changing.  Scoping is one of
> these (although I have to confess that I have made the pitch to Robert
> that we should drop our scoping in favour of the S version - he
> sensibly said "no").

Quite right too.  My favorite example is a function that I and several of
my fellow students have at various times tried to write in S.

jack.lm<-function(lm.obj){
	ii<-as.matrix(1:length(lm.obj$residuals))
	var(t(apply(ii,1,function(i) update(lm.obj,subset=-i)$coef)))
	}

or similar things for bootstrap, weighted bootstrap, glms and so on.  In
every case people have spent hours staring at this code and wondering why
it claims to be unable to find lm.obj. 

My view on the scoping rules of R is that they aren't an incompatibility
since most people I have talked to think that S scopes this way.


Thomas Lumley
------------------------------------------------------+------
Biostatistics		: "Never attribute to malice what  :
Uni of Washington	:  can be adequately explained by  :
Box 357232		:  incompetence" - Hanlon's Razor  :
Seattle WA 98195-7232	:				   :
------------------------------------------------------------

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=