powered by
Date Difference in Years
ydiff(x, y, do.date.convert = TRUE, do.numeric = TRUE)
Vector of differences.
Vector of starting dates or items that can be converted to dates by todate.
Vector of ending dates or items that can be converted to dates by todate.
Convert to dates before running the difference. If you know your columns are already dates, setting to FALSE will make your code run faster.
Convert the output to a number instead of a date difference object.
ydiff( lubridate::mdy( '1/1/2018' ), lubridate::mdy( '3/4/2018' ) )
Run the code above in your browser using DataLab