DEV Community

Mahesh K
Mahesh K

Posted on

Lubridate Package in R

In this post, we take a look at the Lubridate Package in R. You use it with the date specific code in the R Language.

Most of the datasets that deal with the time, you should consider making use of the lubridate to deal with the time and date with those.

I created the video that covered the features of the lubridate package. You can take a look at the video below.

Let's take a look at how it can be installed.

install.packages(lubridate)

and then make sure to use the library in the code.

library(lubridate)

There are many ways we can make use of the lubridate to work with dates. So here is one such that you can make use of as well.

bday <- dmy("22/3/1984")
month(bday)

and say that you want to work with the year.

year(bday)

There are many other ways to work with it say using timezone, setting your own date, getting system date and so on. It's upto you on how you can choose to get the data.

I recommend playing with some documentation examples.

I hope this helps anyone who is trying to learn the data science and exploring the dataset on their own.

Top comments (0)