[R] how to shift a chron timestamp by 6:30 hours
Gabor Grothendieck
ggrothendieck at gmail.com
Thu Jul 28 16:57:54 CEST 2011
On Thu, Jul 28, 2011 at 9:37 AM, Maciej Hoffman-Wecker
<Maciej.Hoffman-Wecker at bioskin.de> wrote:
> Dear help list,
>
> I have a timestamp in as a chron object:
>
>> (x <- chron(dates = c("12/02/11", "22/11/11"),
> + times = c("07:30:00", "04:00:00"),
> + format = c(dates = "d/m/y", times = "h:m:s")))
> [1] (12/02/11 07:30:00) (22/11/11 04:00:00)
>
> Now I want to shift the timestamp by 06:30 (hh:mm) backwards, to get
>
> [1] (12/02/11 01:30:00) (21/11/11 21:30:00)
>
Try this:
x - as.numeric(times("06:30:00"))
If you actually wanted 6 hours behind, which is what the desired
result shown in the post implies, then use "06:00:00" instead.
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-help
mailing list