Skip to contents

[Maturing]

int_mean() computes the mean of an Interval object.

Usage

int_mean(int)

Arguments

int

An Interval vector.

Value

An Interval vector.

See also

Other Interval functions: int_duration(), int_overlap()

Examples

lubridate::interval(
  lubridate::ymd_hms("2023-01-01 22:00:01", tz = "UTC"),
  lubridate::ymd_hms("2023-01-02 02:00:01", tz = "UTC"),
  tzone = "UTC"
) |>
  int_mean()
#> [1] "2023-01-02 00:00:01 UTC"
#> [1] "2023-01-02 00:00:01 UTC" # Expected

c(
  lubridate::interval(
    lubridate::ymd_hms("2023-01-01 22:00:01", tz = "UTC"),
    lubridate::ymd_hms("2023-01-02 02:00:01", tz = "UTC"),
    tzone = "UTC"
  ),
  lubridate::interval(
    lubridate::ymd_hms("1990-01-01 06:00:00", tz = "UTC"),
    lubridate::ymd_hms("1990-01-01 12:00:00", tz = "UTC"),
    tzone = "UTC"
  )
) |>
  int_mean()
#> [1] "2023-01-02 00:00:01 UTC" "1990-01-01 09:00:00 UTC"
#> [1] "2023-01-02 00:00:01 UTC" "1990-01-01 09:00:00 UTC" # Expected