Dear Friends, Let's assume there are three parameters that were passed into fun1. In fun1, we need to modify one para but the remains need to be untouched. And then all parameters were passed into fun2. However, I have failed to achieve it.
Please see the following code. ########################################## fun1 <-function(x, y, z=10) {x+y+z;} fun2 <-function(aa, ...) { a=fun1(x=aa, y=5); # works well a=1+5+10=16 b=fun1(x=aa, ...); # works well b=1+4+8=13 y=0 # it will not affect values passed using ... c=fun1(x=aa, ...) # works well but c = 1+4+8=13 # Some time we may only want to use parts of the inputed variables # we only want to modify y d=fun1(x=aa, y=5, ...); #error : formal argument "y" matched by multiple actual arguments #How can I get the result d=1+5+8=14? c(a, b, c) } fun2(x=1, y=4, z=8) ########################################## I will appreciate it if you would give me any suggestions. Best wishes, Zhiqiu [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.