[Rd] scoping problems (PR#614)

halvorsen kjetilh@umsanet.edu.bo
Tue, 25 Jul 2000 17:46:08 -0400



Robert Gentleman wrote:

>

I tested the proposed change with thre original problem, and now it works fine.
Kjetil Halvorsen

>
>   The problem is with quasi:
> > 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
> ...
> >
> >
> > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> > 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
> > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
> --
> +-------------------------------------------------------------------------+
> | Robert Gentleman              phone : (64-9) 3737-599 ext 3946          |
> | Senior Lecturer               fax :   (64-9) 3737-018                   |
> | Department of Statistics      office : Room 206 Maths/Physics           |
> | University of Auckland        email : rgentlem@stat.auckland.ac.nz      |
> +-------------------------------------------------------------------------+
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._