[R] How to do this simple integration?

Spencer Graves spencer.graves at pdf.com
Fri Jun 9 05:26:49 CEST 2006


	  I can't parse your metacode, so I really don't understand your 
question.  Have you worked the examples in the "?integrate" help page? 
Also, do you understand the "..." argument to the "integrate" (and 
other) functions"?  If the answer to the latter is "no", I suggest you 
also read Venables and Ripley, Modern Applied Statistics with S.

	  If that is not adequate and you'd like more help from this listserve, 
please submit a simple, self-contained example that seems to come the 
closest to something you want but can't quite get, as suggested in the 
posting guide! "www.R-project.org/posting-guide.html".

	  I know this didn't answer your question, but I hope it helps you.

	  Best Wishes,
	  Spencer Graves

Jianing Di wrote:
> Hello,
> 
> I have a simple function in the form as follows:
> 
>> f<-function(x){sum(v^x)}
> 
> where v is a vector. I was trying to integrate f using the command
> 
>> I<-integrate(f,0,1)
> 
> However, this will not work and seems that the reason is to use
> "integrate", the f must be a function that with input and output of same
> length. Anyone can point out which command should I use in order to
> compute this type of integration(such as a function involve sum(), prod(),
> etc.)?
> 
> Thank you.
> 
> Jianing
> 
>



More information about the R-help mailing list