# integrate() (PR#1754)

**dmurdoch@pair.com
**
dmurdoch@pair.com

*Mon, 8 Jul 2002 04:09:34 +0200 (MET DST)*

>*This happens:
*>>* integrate(function(x)1,0,1)
*>*Error in integrate(function(x) 1, 0, 1) : evaluation of function gave a result
*>*of wrong length
*
...
>*This is clearly incorrect behavior. I included case 2 to show that some cases
*>*are
*>*working correctly.
*
This is user error. The help for integrate says the first argument is
"An R function taking a numeric first argument and returning a
numeric vector the same length."
The function has to return a vector answer when a vector argument is
given to it.
Duncan Murdoch
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._