search for: add_elem

Displaying 2 results from an estimated 2 matches for "add_elem".

2017 Sep 05
0
Strange lazy evaluation of default arguments
Mathias, If it's any comfort, I appreciated the example; 'expected' behaviour maybe, but a very nice example for staff/student training! S Ellison > -----Original Message----- > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Matthias > Gondan > Sent: 02 September 2017 18:22 > To: r-help at r-project.org > Subject: [R] Strange lazy evaluation of
2017 Sep 02
6
Strange lazy evaluation of default arguments
Dear R developers, sessionInfo() below Please have a look at the following two versions of the same function: 1. Intended behavior: > Su1 = function(u=100, l=u, mu=0.53, sigma2=4.3^2) + { + print(c(u, l, mu)) # here, l is set to u?s value + u = u/sqrt(sigma2) + l = l/sqrt(sigma2) + mu = mu/sqrt(sigma2) + print(c(u, l, mu)) + } > > Su1() [1] 100.00 100.00 0.53 [1]