Hi,

I have this vector:

 > A <- c("00:00:36","00:02:18")
 > A
[1] "00:00:36" "00:02:18"

I use as.difftime to convert this to time vector based

 > B <- as.difftime(A)
 > B
Time differences in secs
[1]  36 138
attr(,"tzone")
[1] ""

Now i try to make a sum

 > sum(B)
Time difference of 174 secs

The sum is ok, but how to convert this result again do H:M:S format to 
get the result

00:02:54, that is 2 minutes and 54 seconds.

work with times is aways difficult, I try the units parameter in 
as.difftime but dont work.

Thanks
Ronaldo


-- 
8ª lei - Colete seus dados hoje como se você soubesse que seu equipamento
          vai quebrar amanhã.

       --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228.

>  Prof. Ronaldo Reis Júnior
|  .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional
| : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
| `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
|   `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br
| http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to