I folloed this post here double integral in R and switched the function and limits to match below but it's not working.
InnerFunc = function(x) { x + (y^2) }
InnerIntegral = function(z) { sapply(y,
function(z) { integrate(InnerFunc, 0, 2)$value }) }
integrate(InnerIntegral, 0, 1)
I get this error:
Error in integrate(InnerFunc, 0, 2) : evaluation of function gave a result of wrong type