One posibility is to transform the columns into time spans, e.g.:
timeSpan(c("10:30", "09:01"), in.format="%H:%M")
and then just subtract the one from the other. The output is still a time
span; using 'hms' on this gives you the hours, minutes and so on.
Regards,
Henrik
--------------------------------------------------------------------------
Henrik Aalborg Nielsen
Informatics and Mathematical Modelling
Section for Statistics, Time Series Group
Technical University of Denmark
Richard Petersens Plads, Build.321,
DK-2800 Kgs. Lyngby, Denmark.
Phone: +45 4525 3418
Fax.: +45 4588 2673
E-mail: han@imm.dtu.dk
URL: http://www.imm.dtu.dk/~han
--------------------------------------------------------------------------
On Thu, 7 Aug 2003, Dr K M MA wrote:
> Dear sir,
>
> Want to calculate the time difference in minutes of two columns; these
> two columns are input as a dataframe. The format is XX:YY (where XX are
> hours (24 hours) and YY are minutes). How should one do this?
>
> Thanks in advance.
>
> kmma
> Hong Kong
>
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu. To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message: unsubscribe s-news
>
|