[R] Summary: do.call and environments

Patrick Connolly p.connolly at hortresearch.co.nz
Thu Mar 11 21:00:45 CET 2004


On Thu, 11-Mar-2004 at 01:22AM -0800, Spencer Graves wrote:

|> ff1 <- function(fun, x) {
|>   assign(fun, get(fun), 1)
|>   assign("x", x, 1)
|>   do.call(fun, list(y=3))
|> }
|> tst <- ff1("fx", 2)
|> 


|>       This assigns "6" to "tst" in both S-Plus 6.2 as R 1.8.1.
|> However, it also prints "[1] 6" in S-Plus 6.2 but not R.  ???

Good ol' Splus 3.4 gives the same result as R 1.8.1.



-- 
Patrick Connolly
HortResearch
Mt Albert
Auckland
New Zealand 
Ph: +64-9 815 4200 x 7188
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it.  ---Steven Wright 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~




More information about the R-help mailing list