[R] Error in match.fun(f) : object 'x' not found

C W tmrsg11 at gmail.com
Tue Feb 21 18:29:38 CET 2017


Dear R list,

I am having a little trouble understanding the R code. I want to compute
expectation of normal pdf.

I did the following:

integrate(x*dnorm(x, rate=1), -Inf, Inf)
Error in match.fun(f) : object 'x' not found

If I did this, I get,
integrate(dexp(x, rate=1), -Inf, Inf)
Error in dexp(x, rate = 1) : object 'x' not found

How should I fix this? I remember when I did it for curve(), it was fine.

curve(pexp(x, rate = 1/2), from = 0, to = 5)

What am I not getting here? Thank you so much!

	[[alternative HTML version deleted]]



More information about the R-help mailing list