As you got the error message, to use ggplot function, you had better make a
data.frame with your data "d".
for example, d[ n x p], n : observations, p : variables
n = dim(d)
dd = data.frame(x=d[,2:n[2]], y=d[,1])
then, you may get the better result after apply "dd" to the ggplot function.
> p1 +
This example is from "The R Book" by Michael J. Crawley.
d=read.table(
"http://www.bio.ic.ac.uk/research/mjcraw/therbook/data/diminish.txt";
,header=TRUE)
p=qplot(xv,yv,data=d); p
m1=lm(yv~xv,data=d)
p1=p + geom_abline(intercept=coefficients(m1)[1],
slope=coefficients(m1)[2] ); p1
m2=lm(yv~xv + I
2 matches
Mail list logo