[R] Do loop

N Dey ndey00 at yahoo.com
Tue Apr 22 15:46:07 CEST 2003


Dear all,

I am doing integration by using integrate(..) command
of R.  Integrand is a function of parameters (say p).
And I ahve to do the integration for p ranging from 10
to 500 (eg p<-10*1:50). And I want to store the
results in a table like.

p	result
10	------
20	------

Is there any easy way to do this. I was trying 
for(p<-10*1:50){integrate(Func, lower = 0, upper =
182)}, but some problem couldn't do it.


> Func<-function(x,p){exp(2*x-(3*p/10))*exp(-(5*x))}
> for(p in 10*1:50){integrate(Func, lower = 0, upper =
182)}
Error in f(x, ...) : Argument "p" is missing, with no
default

Pl. help me, thanking you.

best regards,
N Dey



More information about the R-help mailing list