[R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
Bert Gunter
gunter.berton at gene.com
Wed Aug 31 17:05:31 CEST 2011
>
> In R functions are "things" but they are not "strings" and cannot be
> executed by just asserting a character vector element.
... But note that they can be executed by by asserting a list of
functions component (as well as by do.call below)
> x <- c(rnorm, rt, rweibull) ## this is a list of functions
> x[[2]](10,df=5)
[1] -1.03683857 1.20245119 -2.77762457 -0.02124206 -0.78748356 1.36294023
[7] 0.50626709 -0.37386404 0.34371389 -1.28934128
Cheers,
Bert
If you want to
> construct a 'call' from a a character, you can bridge that divide with
> do.call:
>
> ?do.call
> fn <- paste("d", "gamma", sep="")
> do.call(fn, list(1:10, shape=1) )
> [1] 0.36787944117 0.13533528324 0.04978706837 0.01831563889 0.00673794700
> [6] 0.00247875218 0.00091188197 0.00033546263 0.00012340980 0.00004539993
>
> --
> David
>
More information about the R-help
mailing list