From p.dalgaard at biostat.ku.dk  Thu Feb  5 02:11:41 2004
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Thu Feb  5 02:11:25 2004
Subject: [Rd] Scoping bug in ftable() (PR#6541)
In-Reply-To: <20040204183230.F3CFCEDDF@slim.kubism.ku.dk>
References: <20040204183230.F3CFCEDDF@slim.kubism.ku.dk>
Message-ID: <x2ptcucotu.fsf@biostat.ku.dk>

dmurdoch@pair.com writes:

> x <- do.call("table", c(as.list(substitute(list(...)))[-1],
> list(exclude = exclude)))
> 
> I think this call is finding the local variable "x" (which has been
> used before this line) instead of the argument "x" and thus produces
> an incorrect result.
> 
> How should this be fixed?  What we want is to convert "..." into an
> evaluated list that includes the deparsed arguments as names.  Just
> plain list(...) loses the names.

The knee-jerk reflex on seeing substitute() with ... or formal
arguments is that you need eval.parent somewhere since the names or
expressions passed to a function usually make better sense to the
parent than they do to the current function.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] Scoping bug in ftable() (PR#6541)
Peter Dalgaard