[Rd] Scoping bug in ftable() (PR#6541)
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Thu Feb 5 02:11:41 MET 2004
dmurdoch at 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 at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-devel
mailing list