difftime Function in R (Example)

This tutorial shows how to compute the time difference of two date objects with the difftime() function in the R programming language.

Example Data

time_1 <- "2019-08-20 16:09:21"                # First time object
time_2 <- "2019-09-30 13:09:24"                # Second time object

Calculate Time Difference with difftime Function

difftime(time_1, time_2)                       # Application of difftime function
# Time difference of -40.87503 days

The time difference of our two date objects is 40.87503 days.

Video Explanation

You are currently viewing a placeholder content from YouTube. To access the actual content, click the button below. Please note that doing so will share data with third-party providers.

More Information

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top