[R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

. . xkziloj at gmail.com
Wed Aug 31 04:08:13 CEST 2011


Hi all,

Why I am getting,

Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

Thanks in advance!

func <- Vectorize(function(x, a, sad, trunc=0, ...) {
  result <- function(x) {
    f1 <- function(n) {
      dcom <- paste("d", deparse(substitute(sad)), sep="")
    	dots <- c(as.name("n"), list(...))
			f <- do.call(dcom, dots)
      g <- dpois(x,a*n)
      f * g
    }
    integrate(f1, 0, Inf)$value
  }
  return(result(x) / (1 - result(trunc)))
}, "x")

func(1, 0.1, exp)



More information about the R-help mailing list