[R] Problems plotting and regression w.r.t. date data type on x axis

Kategoricus residual at users.sourceforge.net
Thu Feb 14 12:24:32 CET 2013


Hello Petr!

thanks a lot for your help. The plot command plots well, but the abline
returns without error and does nothing.

> str(tabelle)
'data.frame':   4 obs. of  3 variables:
 $ date  : Factor w/ 4 levels "2009-01-1","2009-12-1",..: 1 2 3 4
 $ number: int  1673 2111 2487 4301
 $ date2 : POSIXlt, format: "2009-01-01" "2009-12-01" ...
> plot(tabelle$date2,tabelle$number, pch=19, xlab="date of retrieval",
> ylab="number of animals")
> regression.punkte<-lm(tabelle$number ~ as.Date(tabelle$date))
> regression.punkte

Call:
lm(formula = tabelle$number ~ as.Date(tabelle$date))

Coefficients:
          (Intercept)  as.Date(tabelle$date)  
           -24046.326                  1.799  

> abline(regression.punkte, lwd=2)
> 



--
View this message in context: http://r.789695.n4.nabble.com/Problems-plotting-and-regression-w-r-t-date-data-type-on-x-axis-tp4658518p4658529.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list