[Lign251] HW3 Q3
rlevy at ling.ucsd.edu
rlevy at ling.ucsd.edu
Sun Oct 21 17:23:19 PDT 2007
Kathryn Davidson wrote:
> > > d2norm
> > function(x){0.75*dnorm(x, 6.35, 0.04) + (1-.75)*dnorm(x, 6.57, 0.03)}
> > > plot(d2norm, 6.2, 6.68)
> > > hist(word.means, breaks=40, prob=T)
> > > lines(d2norm)
> > Error in as.vector(x, "double") : cannot coerce to vector
Ah, I got it. The plot() function can be passed a function plus a lower +
upper limit on the values to be passed to the function, but the lines()
function can't. You'll want to do this:
x <- seq(6.2,6.68,by=0.01)
lines(x,d2norm(x))
I actually didn't know that you can pass plot() a function! Thanks for
sharing :)
Roger
More information about the Lign251
mailing list