[R] How to find out the trend during a time period?

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Oct 28 10:20:56 CEST 2010



On 28.10.2010 06:50, Lao Meng wrote:
> Hi all:
> I have a dataset which contains two variables: Y and time
> y<-c(228,189,232,198,252,315)
> time<-2003:2008
>
> How can I find out the trend(increase/decrease) of y along the time period?
>
> If I use:
> lm(y~time)
>
> The "lm" command treats time as natural number,but not date.

What is "date"? WHere is the reproducible example?

Uwe Ligges



> So maybe "lm" isn't appropriate.
>
> Then,which function could be used?
>
> Thanks a lot for your help.
>
> My best
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list