[R] ploting several functions on the same plot
Julio Sergio
juliosergio at gmail.com
Thu Apr 4 01:35:36 CEST 2013
I want to superimpose two functions plots in the same page. The functions L0
and L1, defined below
f0 <- function(mu, xm, ds, n) {
1 - pnorm((xm-mu)/(ds/sqrt(n)))
}
f1 <- function(mu,n) f0(mu, 386.8, 48, n)
L0 <- function(mu) f1(mu, 36)
plot(L0,ylim=c(0,1),xlim=c(360,420))
L1 <- function(mu) f1(mu,100)
lines(L1)
The plot of L0 works pretty well. However, when trying to plot the second
function, L1, the interpreter issues an error:
Error in as.double(y) :
cannot coerce type 'closure' to vector of type 'double'
How can I solve my problem, since I want to have both plots with the same
quality? I mean, I don't want to produce an approximating polygonal for the
second function.
Thanks,
-Sergio.
More information about the R-help
mailing list