How to calculate Years between Dates in R ?
In this article, we will discuss how to calculate the number of years or difference of years between two dates in R programming language.
Date_1 = 2020/02/21
Date_2 = 2023/03/21
In Date_1 and Date_2 have three years difference in year.
Here we will use seq() function to get the result. This function is used to create a sequence of elements in a Vector.
length(seq(from=date_1, to=date_2, by=’year’)) -1
My Personal Notes arrow_drop_up
Please Login to comment...