2021-10-31

Parametrize a function with a variable. Then delete the variable

I would like to make the following code run:

mu = 5
rnorm2 <- function(N) rnorm(N, mean = mu, sd = 1)

And then be able to use the rnorm2 function regardless of the presence of the mu variable in the environment. In other words, set the value of the 'mean' argument with the "mu" value once and for all.

Is that possible ?



from Recent Questions - Stack Overflow https://ift.tt/3EpkHgm
https://ift.tt/eA8V8J

No comments:

Post a Comment