Okay, let me try to better say what I meant: myfun1<-function(x=5,pa) { return(pa[1]*x^2+pa[2]*x+pa[3]) } myfun2<-function(x=5,param,myfunk1) { return(param[1]*myfunk1(x)+param[2]*myfunk1(x)) } test<-function(pars1,pars2,lo,up){ mf=myfun1(x=2,pa=8*pars1) integ=integrate(f=myfun2,lower=lo,upper=up,param=pars2,myfunk1=mf) return( 2*integ$value ) } test(pars1=c(1,2,3),pars2=c(-1,1),lo=2,up=7)
So the function myfun2 will be integrated and has a function (myfunk1) itself as an argument. Why is this not possible? Thanks, Thomas PS: the "x=5" and "pa=8*" has no influence... ______________________________________________ R-help@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.