[R] access to right time unit when checking for time execution

Christine SINOQUET christine.sinoquet at univ-nantes.fr
Sat Jan 15 12:57:05 CET 2011


Hello,

I really wonder how to distinguish between secs and mins in the example 
below.

In other terms, how can I access the time unit in variable d ?

start1 <- Sys.time();
stop1 <- Sys.time(); d <- stop1-start1; print(d); 
v<-unlist(strsplit(as.character(d), split=" ")); print(v)
Time difference of 3.024054 secs
[1] "3.02405381202698"

stop1 <- Sys.time(); d <- stop1-start1; print(d);
v <- unlist(strsplit(as.character(d), split=" ")); print(v)
Time difference of 3.189143 mins
[1] "3.18914334774017"


Thank you in advance for your kind help.

C.S.



More information about the R-help mailing list