Skip to content
Back to formatted view

Raw Message

Message-ID: <FA028472-A997-4769-BC55-3884EEAE4025@comcast.net>
Date: 2014-11-21T23:09:13Z
From: David Winsemius
Subject: Help with Time
In-Reply-To: <CADgEnD=MnvGDoAM4d3ca+JuqbLg+3VRJBrf7d53eLyMtpr1W1Q@mail.gmail.com>

On Nov 21, 2014, at 2:52 PM, Raghuraman Ramachandran wrote:

> Dear guRus
> 
> How can I round of time in R to the nearest 30th minute please?
> 
> For example suppose if
>> Sys.time()
> [1] "2014-11-21 22:49:05.59042 GMT"
> then I would like a function that outputs 22:30:00.
> 
> if Sys.time is 12:13:22 then I would like to get 12:00:00 etc.

There already are round and trunc functions for POSIXt objects so why not take a look a that code and hack it into a shape that you find useful.

-- 

David Winsemius
Alameda, CA, USA