is_difftime_less {fritools2}R Documentation

Check Whether Two Times Differ Less Than A Given Value

Description

This is just a wrapper to difftime.

Usage

is_difftime_less(
  time1,
  time2,
  less_than = 1,
  units = "days",
  verbose = FALSE,
  visible = !verbose,
  stop_on_error = FALSE
)

Arguments

time1

See difftime.

time2

See difftime.

less_than

The number of units that would be too much of a difference.

units

See difftime.

verbose

Be verbose?

visible

Set to FALSE to return invisible.

stop_on_error

Throw an error if the time lag is not less than less_than.

Value

TRUE if the times do not differ 'that much', but see stop_on_error.

See Also

Other bits and pieces: golden_ratio(), is_valid_primary_key(), r_cmd_install(), str2num(), strip_off_attributes(), tapply(), throw()

Examples

a <- as.POSIXct(0, origin = "1970-01-01", tz = "GMT")
b <- as.POSIXct(60*60*24, origin = "1970-01-01", tz = "GMT")
c <- as.POSIXct(60*60*24 - 1, origin = "1970-01-01", tz = "GMT")
is_difftime_less(a, b)
is_difftime_less(a, c)
print(is_difftime_less(a, b, verbose = TRUE))
print(is_difftime_less(a, c, verbose = TRUE))
try(is_difftime_less(a, b, stop_on_error = TRUE))
is_difftime_less(a, c, verbose = TRUE, stop_on_error = TRUE)

[Package fritools2 version 4.1.0 Index]