[R] Error in f(x, ...) : could not find function "f2"
Uwe Ligges
ligges at statistik.tu-dortmund.de
Tue Aug 30 20:47:24 CEST 2011
On 30.08.2011 14:31, . . wrote:
> Hi all,
>
> I am getting the erro showed in the subject. I was strange the this
> becomes to happen after a computer restar. I think after the restart
> another function f2 was in memory and it scape from me.
>
> 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)
> }
". .", obviously f2 is a call rather than a function.
Uwe Ligges
> 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)
>
> Any idea?
>
> Thanks in advance.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list