Hello, probably a newbie question, but i didnt find any information on plotting/regressing w.r.t. a date data type. My trials were unfruitful. Can anyone help ? Thanks in advance!
Here is my interaction with R: > tabelle date number date2 1 2009-01-1 1673 2009-01-01 2 2009-12-1 2111 2009-12-01 3 2010-7-1 2487 2010-07-01 4 2013-2-1 4301 2013-02-01 > regression.punkte<-lm(tabelle$number ~ tabelle$date2) Fehler in model.frame.default(formula = tabelle$number ~ tabelle$date2, : ungültiger Typ (list) für die Variable 'tabelle$date2' > regression.punkte<-lm(tabelle$number ~ tabelle$date) > plot(tabelle$date2,tabelle$number, pch=19, xlab="date of retrieval", > ylab="number of animals") ***R DRAWS THIS*** > regression.punkte Call: lm(formula = tabelle$number ~ tabelle$date) Coefficients: (Intercept) tabelle$date2009-12-1 tabelle$date2010-7-1 1673 438 814 tabelle$date2013-2-1 2628 > abline(regression.punkte, lwd=2) ***R DOES NOT DRAW LINE*** Warnmeldung: In abline(regression.punkte, lwd = 2) : nutze nur die ersten beiden von 4 Regressionskoeffizienten > summary(regression.punkte) Call: lm(formula = tabelle$number ~ tabelle$date) Residuals: ALL 4 residuals are 0: no residual degrees of freedom! Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1673 NA NA NA tabelle$date2009-12-1 438 NA NA NA tabelle$date2010-7-1 814 NA NA NA tabelle$date2013-2-1 2628 NA NA NA Residual standard error: NaN on 0 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: NaN F-statistic: NaN on 3 and 0 DF, p-value: NA -- View this message in context: http://r.789695.n4.nabble.com/Problems-plotting-and-regression-w-r-t-date-data-type-on-x-axis-tp4658518.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.