Hello David and David:
Thanks for responding
On 12/10/2015 01:33 AM, David Winsemius wrote:>> On Dec 9, 2015, at 10:58 AM, Micha Silver <micha at arava.co.il>
wrote:
>>
>> Hello all:
>> I am creating a time series using seq.POSIXt.
>>
>> ts.full <- as.character(seq.POSIXt(as.POSIXct(start(d.zoo)),
as.POSIXct(end(d.zoo)), by="hour"))
>>
>> The period crosses the hour of change from "summer time" to
"winter time". When checking with:
>> duplicated(ts.full)
>> I see that there are some duplicate hours. These fall right at the time
change. How can I avoid this? (or remove the duplicates)?
> If you want us to redefine Daylight Savings time, then you should specify
in great detail exactly how this should be done.
>
> I don?t see any duplicates, anyway, since the DST zones are incuded:
>
>> seq(as.POSIXct("2015-10-31 23:00"),
as.POSIXct("2015-11-01 4:00"), by="1 hour")
> [1] "2015-10-31 23:00:00 PDT" "2015-11-01 00:00:00 PDT"
"2015-11-01 01:00:00 PDT"
> [4] "2015-11-01 01:00:00 PST" "2015-11-01 02:00:00 PST"
"2015-11-01 03:00:00 PST"
> [7] "2015-11-01 04:00:00 PST?
Here's what I get:
> Sys.time()
[1] "2015-12-10 08:36:58 IST"
> as.character(seq.POSIXt(as.POSIXct("2015-10-24 23:00"),
as.POSIXct("2015-10-25 04:00"), by="hour"))
[1] "2015-10-24 23:00:00" "2015-10-25 00:00:00"
"2015-10-25 01:00:00"
[4] "2015-10-25 01:00:00" "2015-10-25 02:00:00"
"2015-10-25 03:00:00"
[7] "2015-10-25 04:00:00"
with the dups at 01:00.
But then explicitly adding the timezone gives:
> as.character(seq.POSIXt(as.POSIXct("2015-10-24 23:00"),
as.POSIXct("2015-10-25 04:00"), by="hour"),
tz="IDT")
[1] "2015-10-24 20:00:00" "2015-10-24 21:00:00"
"2015-10-24 22:00:00"
[4] "2015-10-24 23:00:00" "2015-10-25 00:00:00"
"2015-10-25 01:00:00"
[7] "2015-10-25 02:00:00"
so I guess problem solved, thanks.
> But if you use GMT you do get a sequence with no ?duplicates:
>
>> seq(as.POSIXct("2015-10-31 23:00", tz="GMT"),
as.POSIXct("2015-11-01 4:00", tz="GMT"), by="1
hour")
> [1] "2015-10-31 23:00:00 GMT" "2015-11-01 00:00:00 GMT"
"2015-11-01 01:00:00 GMT"
> [4] "2015-11-01 02:00:00 GMT" "2015-11-01 03:00:00 GMT"
"2015-11-01 04:00:00 GMT"
>
>> Thanks
>> --
>> Micha Silver
>> Arava Drainage Authority
>> +972-523-665918
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
> David Winsemius
> Alameda, CA, USA
>
>
> This mail was received via Mail-SeCure System.
>
>