I'm working in R and I would like to know if it is possible to create a function f(x) obtained from an integral of a function g(x,y) with respect to the variable y for example in (0,1), lets say:
I tried this code
f <- function(x){integrate(function(y){g(x,y),0, 1)}
(with g(x,y) an explicit function) but it didn't work unless I fixed x.
Also some help with formatting would be awesome since this is unreadable! Thanks!
