[R] seq

Gabor Grothendieck ggrothendieck at gmail.com
Mon Apr 10 20:09:08 CEST 2006


Its undoubtedly a timezone or daylight savings time issue.  Use this
instead:

> seq(from=as.Date('2005-12-4'), to=as.Date('2006-4-9'), by='weeks')
 [1] "2005-12-04" "2005-12-11" "2005-12-18" "2005-12-25" "2006-01-01"
 [6] "2006-01-08" "2006-01-15" "2006-01-22" "2006-01-29" "2006-02-05"
[11] "2006-02-12" "2006-02-19" "2006-02-26" "2006-03-05" "2006-03-12"
[16] "2006-03-19" "2006-03-26" "2006-04-02" "2006-04-09"

and read the R News 4/1 help desk article to learn more about this.

On 4/10/06, Omar Lakkis <uofiowa at gmail.com> wrote:
> Can someone, please, help explain to me why the following two calls
> return the same set:
>
> >  seq(from=as.POSIXlt('2005-12-4'), to=as.POSIXlt('2006-4-2'), by='weeks')
>  [1] "2005-12-04 EST" "2005-12-11 EST" "2005-12-18 EST" "2005-12-25 EST"
>  [5] "2006-01-01 EST" "2006-01-08 EST" "2006-01-15 EST" "2006-01-22 EST"
>  [9] "2006-01-29 EST" "2006-02-05 EST" "2006-02-12 EST" "2006-02-19 EST"
> [13] "2006-02-26 EST" "2006-03-05 EST" "2006-03-12 EST" "2006-03-19 EST"
> [17] "2006-03-26 EST" "2006-04-02 EST"
>
> >  seq(from=as.POSIXlt('2005-12-4'), to=as.POSIXlt('2006-4-9'), by='weeks')
>  [1] "2005-12-04 EST" "2005-12-11 EST" "2005-12-18 EST" "2005-12-25 EST"
>  [5] "2006-01-01 EST" "2006-01-08 EST" "2006-01-15 EST" "2006-01-22 EST"
>  [9] "2006-01-29 EST" "2006-02-05 EST" "2006-02-12 EST" "2006-02-19 EST"
> [13] "2006-02-26 EST" "2006-03-05 EST" "2006-03-12 EST" "2006-03-19 EST"
> [17] "2006-03-26 EST" "2006-04-02 EST"
>
>
> > seq
> function (...)
> UseMethod("seq")
> <environment: namespace:base>
>
> I am using R 2.2.1 on linux.
> Why isn't "2006-04-09" in the response of the second call?
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list