Hi all,

#####################################
integ=function(f,n){ 
        # computes vector y = f(x)
        x=runif(10000)
        y=f
        hatI=mean(y)
        hatI
}
# example of use
integ(x^2+x+100,100)
#####################################
it returns an error says no obj 'x'

how do I 'tell' R to treat 'f' as an input expression?

Thanks.

casper
-- 
View this message in context: 
http://r.789695.n4.nabble.com/how-to-use-expression-as-function-arguements-tp3093940p3093940.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to