Finds the difference between two timestamps.

calc_time_between(
  dataset,
  begining_time,
  end_time,
  new_name = "time_diff",
  unitx = "days"
)

Arguments

dataset

The dataset you are working with.

begining_time

POSIXct variable that denotes the start of the time interval.

end_time

POSIXct variable that that denotes the end of the time interval.

new_name

Character variable that indicates what you want to the time difference variable to be called.

unitx

Character variable that indicates what units to return time difference, default is days.

Value

Gives a dataset with a new variable consisting of the difference between two time periods

Examples

if (FALSE) { data <- data %>% calc_time_between(culture_start, culture_end, unitx = "days") data <- calc_time_between(data, lactate_start, lactate_end, unitx = "hours") }