Skip to content

scoping problems (PR#614)

3 messages · Robert Gentleman, Kjetil Halvorsen

#
I am resubmitting this to r-bugs, since Thomas Lumley indicates that it
might be an error:
On Wed, 5 Jul 2000, Thomas Lumley wrote:

            
subset=No>0,family=quasi(link=power(pow),var=mu^2))
place.
As an additional note. This probably won't work if the argument to
testcar
is a variable.

A more reliable version is
 eval(substitute(glm(Pound~CG+Age+Vage,data=car,weights=No subset=No>0,
 family=quasi(link=power(pow),var=mu^2))),list(pow=pow))

( I moved the ,list argument from "substitute" to "eval" to get it
work.)

Kjetil Halvorsen




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Mon, Jul 24, 2000 at 11:51:12PM +0200, kjetilh@umsanet.edu.bo wrote:
The problem is with quasi:
function (link = "identity", variance = "constant") 
{
    linktemp <- substitute(link)
    if (is.expression(linktemp)) 
        linktemp <- eval(linktemp)
    if (!is.character(linktemp)) {
        linktemp <- deparse(linktemp)
        if (linktemp == "link") 
            linktemp <- eval(link)
    }
   ...

  Note that neither of the eval's is what is wanted. At this point
  you just want to force the promise, ie evaluate the argument in
  the calling environment.
  The following piece of code seems to do that:

 > quasi
function (link = "identity", variance = "constant") 
{
    linktemp <- substitute(link)
    if ( is.expression(linktemp) || is.call(linktemp) ) 
        linktemp <- link
    else if (!is.character(linktemp)) 
        linktemp <- deparse(linktemp)
    if( is.character(linktemp) )
        stats <- make.link(linktemp)
    else
        stats <- linktemp
...

  
    
#
Robert Gentleman wrote:

            
I tested the proposed change with thre original problem, and now it works fine.
Kjetil Halvorsen
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._