Displaying 1 result from an estimated 1 matches for "rdistr".
Did you mean:
distr
2008 May 23
1
Evaluation "conflict" in combination of replicate() and rexp()as variable inside a function
...generating functions inside a self-defined "wrapper" function I encounterd
a puzzling behaviour.
The following are intentionally simple (and rather nonsense-) examples to
isolate the relevant aspects. Please, note the seemingly "inconsistent"
behaviour for the second call of rdistr() (with distr = rexp) for which I
have not found any explanation (yet):
> rdistr <- function( distr, ...) replicate( 1, distr( n = 1, ...))
> rdistr( distr = rnorm)
[1] -0.8889223
> rdistr( distr = rexp)
[1] NaN
Warning message:
In distr(n = 1, ...) : NAs produced
> rdistr( dist...