Calculating time lapse specific to another column variable.

Hi, and welcome!

The first step will be importing your data into an R data frame. Then confirm that your PM column is a date class

#> Attaching package: 'lubridate'
#> The following object is masked from 'package:base':
#>     date

leave <- ymd_hms("2011-08-10 14:00:00", tz = "Pacific/Auckland")
#> [1] "POSIXct" "POSIXt"

Created on 2019-12-19 by the reprex package (v0.3.0)

You'll want to install lubridate. The package has since been updated, but the introduction will give you a good orientation.

Once you have PM right, you'll be working with duration objects.

When you get stuck, come back with a new post including a reproducible example, called a reprex for more help.

Good decision to learn R! (I'm biased, as a long-term user.) I hope you find it a useful and fun as I have.