powered by
Calculate time difference and return a number
time_delta(t1, t2, units = "secs")
numeric difference of time in units specified
time start
time end
character, choices are 'secs', 'mins', 'hours', and 'days'
'secs'
'mins'
'hours'
'days'
a = Sys.time() Sys.sleep(0.3) b = Sys.time() time_delta(a, b) # In seconds, around 0.3 time_delta(a, b, 'mins') # in minutes, around 0.005
Run the code above in your browser using DataLab