f2 nao ta definida como função (olha como tu definiu f e f1 e compara com f2)
[]'s 2011/8/30 . . <[email protected]> > Olá pessoal, > > ao rodar a função abaixo, obtenho o erro > > Error in f(x, ...) : could not find function "f2" > > ...mas f2 está definida logo acima de f... > > Alguma dica? > > Obrigado. > > func <- Vectorize(FUN= > function(y, frac, rate, sad, samp="Poisson", trunc=0, ...){ > f0 <- function(y,frac,n) { > f1 <- function(y,frac,n){ > dpois(y,frac*n) > } > dcom <- paste("d",deparse(substitute(sad)),sep="") > dots <- c(as.name("n"),list(...)) > f2 <- call(dcom,dots) > f <- function(n){ > f1(y,frac,n)*f2(n) > } > myintegrate <- function() { > r <- 0 > r1 <- 1 > x1 <- 0 > dx <- 20 > while(r1 > 10e-500) { > r1 <- integrate(f,x1,x1+dx)$value > r <- r + r1 > x1 <- x1 + dx > } > integrate(f,x1,Inf)$valu > } > myintegrate() > } > f0(y,frac,n)/(1-f0(trunc,frac,n)) > },"y") > > func(10, 0.1, 0.1, exp) > _______________________________________________ > R-br mailing list > [email protected] > https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br > Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça > código mínimo reproduzível. >
_______________________________________________ R-br mailing list [email protected] https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código mínimo reproduzível.
