internal_time_difference: Calculate difference between two date or times inline

Description Usage Arguments Details

View source: R/internal_time_difference.R

Description

Many measures need to work on the difference between two date/times.

Usage

1
internal_time_difference(start_field, end_field, units = "mins")

Arguments

start_field

The field at the beginning of the time interval.

end_field

The field at the end of the time interval.

units

This is a string which must match those in the difftime function (ie. 'minutes', 'hours', 'days' etc)

Details

This function calculates the difference between those times, or returns an NA. The returned value is an integer, which makes calculations simple.

Always calculate to the lowest precision you want to report - so if you want to report hours and minutes then ask for the time in minutes and convert the value later at the printing stage to be in hours and minutes.

Many measures needing this should ideally have this value stored in the source data ultimately, so should be recorded for potential review of database inputs at a later stage.


md0u80c9/SSNAPStats documentation built on Feb. 11, 2020, 11:43 a.m.