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. ???
Best Wishes, Spencer Graves
Thomas Petzoldt wrote:
Hello,
> f("fx",2) [1] 6
I would have naively expected 14. From whence cometh "6"?
Also, I prefer to use transportable code wherever feasible. The
2*3=6, which was the intention. It is in fact only a proof of correctness, that "7" is not used here. The proposal of Gabor does exactly, what I want, but if it does not work on S-PLUS, it's a serious disadvantage and I should check this too.
Thomas P.
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html