search for: munormalized

Displaying 4 results from an estimated 4 matches for "munormalized".

Did you mean: unormalized
2017 Sep 02
2
Strange lazy evaluation of default arguments
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/sqrt(sigma2) c(uNormalized, lNormalized, muNormalized) } > Su3(verbose=TRUE) [1] 100.00 100.00 0.53 [1] 23.2558140 23.2558140 0.1232558 > Su3(verbose=FALSE) [1] 23.2558140 23.2558140 0.1232558 Not redefining variables at all makes debugging easier, although it may waste sp...
2017 Sep 02
0
Strange lazy evaluation of default arguments
...rguments 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/sqrt(sigma2) ? ? c(uNormalized, lNormalized, muNormalized) ? } > Su3(verbose=TRUE) [1] 100.00 100.00 ? 0.53 [1] 23.2558140 23.2558140 ?0.1232558 > Su3(verbose=FALSE) [1] 23.2558140 23.2558140 ?0.1232558 Not redefining variables at all makes debugging easier, although it may waste sp...
2017 Sep 02
0
Strange lazy evaluation of default arguments
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 <matthias-gondan at gmx.de>: > Dear R developers, > > sessionInfo() below > > Please have a look at the following two versions of the same function: > > 1. Intended
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]