lubridate Package| Arithmetic with Date-time objects

Опубликовано: 10 Май 2026
на канале: Plotly Analytics - Giving Life to Data
35
0

In this video we will learn the basic arithmetic operations that can be performed on date time objects. We will also look at the time span concept - lubridate package has two time span classes :

Duration class
Period class

Duration - The Duration class will always supply mathematically precise results. A duration year will always equal 365 days. Duration class follows stop-watch concept of time-span. Thus, duration class won't take into account leap years or any other time changes.

Period - Periods, on the other hand, fluctuate the same way the timeline does to give intuitive results.
Period class follows human concept of time span. Periods will take care of leap year, day-light saving calculations and generate the result.

We will work on share_price and transactions data set and try to use arithmetic operators on its date-time variables.

Video link on Parsing Date time objects:
   • lubridate package | Parsing time series data  

Video link on filter function from dplyr package
   • Dplyr Package | How to filter rows using f...  

Video link on mutate function from dplyr package
   • Dplyr Package | Use mutate ( ) function to...  

Video link on summarise function from dplyr package:
   • Dplyr Package | Generate data summary usin...  

The Rmarkdown file with data-sets is available on Github repo:
https://github.com/siddharth-sahasrab...