[R] problems with abline in a time line scatterplot
tilapia
carpaij at bluemail.ch
Thu Dec 23 00:14:10 CET 2010
Hello R-Users
i'm stuck with the following problem:
i want to add a trend line to a scatterplot. the x axis is a time line.
well it doesnt work, it seems that the function abline is not able
to handle the fact, that i used the column Date as a factor.
this is the script:
data<-read.table('DO_hapa_all_morning.txt',header=T,as.is=2)
attach(data)
names(data)
plot(DO,axes=F,xlab="Date",ylab="DO [mg/l]",ylim=c(0,12),col="red")
axis(1,at=1:length(DO),labels=Date)
axis(2)
abline(lm(DO~Date),col="red")
this warning message shows up (last row translated from german):
warning:
1: In model.matrix.default(mt, mf, contrasts) :
variable 'Date' converted to a factor
2: In abline(lm(DO ~ Date), col = "red") :
use only the first two of 54 regression coefficients
is abline not the right function, or is there a possibiliy to solve it with
the way i started it?
thank you for any guidance!
Chris
--
View this message in context: http://r.789695.n4.nabble.com/problems-with-abline-in-a-time-line-scatterplot-tp3161401p3161401.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list