William Dunlap
>Gesendet: Samstag, 2. September 2017 19:41
>An: Rui Barradas
>Cc: Matthias Gondan; r-help@r-project.org
>Betreff: Re: [R] Strange lazy evaluation of default arguments
>
>Another way to avoid the problem is to not redefine variables that are
>argume
happen? [it’s documented
behavior, but still…]
So, I’ll stick with R. Still 25 years or so until retirement, but I’ll survive,
even without crossreferenced default arguments.
Best wishes,
Matthias
Von: S Ellison
Gesendet: Dienstag, 5. September 2017 16:17
An: Matthias Gondan; r-help@r-project.
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-boun...@r-project.org] On Behalf Of Matthias
> Gondan
> Sent: 02 September 2017 18:22
> T
This is exactly as expected. See section 4.3.3 of the R Language definition
or google around on "R Lazy Evaluation" for details.
You should not "expect" R's semantics to be the same as other languages
with which you may be familiar. Spending time with a good tutorial or two
should help you sort ou
Yes, this is intended behavior, and it has everything to do with where the
parameters are first referenced and nothing to do with debugging.
--
Sent from my phone. Please excuse my brevity.
On September 2, 2017 10:22:22 AM PDT, Matthias Gondan
wrote:
>Dear R developers,
>
>sessionInfo() below
mu=0.53, sigma2=4.3^2) # instead of l=u
And maybe also „in-place“ changes of values…
Best regards,
Matthias
Von: William Dunlap
Gesendet: Samstag, 2. September 2017 19:41
An: Rui Barradas
Cc: Matthias Gondan; r-help@r-project.org
Betreff: Re: [R] Strange lazy evaluation of default argume
Another way to avoid the problem is to not redefine variables that are
arguments. E.g.,
> Su3 <- function(u=100, l=u, mu=0.53, sigma2=4.3^2, verbose)
{
if (verbose) {
print(c(u, l, mu))
}
uNormalized <- u/sqrt(sigma2)
lNormalized <- l/sqrt(sigma2)
muNormalized <- mu/sq
Hello,
One way of preventing that is to use ?force.
Just put
force(l)
right after the commented out print and before you change 'u'.
Hope this helps,
Rui Barradas
Citando Matthias Gondan :
Dear R developers,
sessionInfo() below
Please have a look at the following two versions of the
8 matches
Mail list logo