Coding time durations

Hey guys -

trying to code for a duration of time - mm:ss:ms - finding it a little tricky as i haven't done it before. ANy help would be great. Thanks.

# time difference example showing results in seconds
# Sys.sleep(20) creates a pause of 20 seconds
my_time <- Sys.time()
Sys.sleep(20)
my_next_time <- Sys.time()
difftime(my_time, my_next_time, units = "secs")

If you search for date & time variables in R you will see there are several classes. You'll have to map the features vs complexity for each type compared to what you are trying to accomplish.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.