[R] Help with adding minutes to time

Sebastian Luque spluque at gmail.com
Tue May 30 19:43:40 CEST 2006


"Jean-Louis Abitbol" <abitbol at sent.com> wrote:

> Dear R Helpers,

> I need to read time from a .csv file which is formated as chartime
> (09:12:00) below. I need to add one minute (cf chartime2).
> Then I need to output the value just as 09:13 without the seconds for
> writing a csv file and input in another program.

[...]

The numeric representation of chron objects is expressed in day units, and
there are sensible arithmetic methods:

chrontime <- times("09:12:00") + 1/24/60

and then:

paste(hours(chrontime), minutes(chrontime), sep=":")


Cheers,

-- 
Seb



More information about the R-help mailing list