stap2duration: Compute duration of stationary periods

View source: R/stap2duration.R

stap2durationR Documentation

Compute duration of stationary periods

Description

This function returns the duration between stap$start and stap$end.

The function can be used with any data.frame containing start and end as POSIXct (e.g., flight or path).

Usage

stap2duration(stap_path, units = "days", return_numeric = TRUE)

Arguments

stap_path

A stap data.frame.

units

character string. Units in which the results are desired. Can be abbreviated. See difftime()

return_numeric

logical to return the duration as a numeric rather than with a duration format.

Value

vector of duration

Examples

# Create fake stap
stap <- data.frame(
  start = seq(as.POSIXct("1990-01-01"), as.POSIXct("1991-01-01"), length.out = 13)
)
stap$end <- stap$start + 60 * 60 * 24 * 30
stap$stap_id <- seq_len(nrow(stap))

stap2duration(stap)

stap2duration(stap, units = "mins", return_numeric = FALSE)


Rafnuss/GeoPressureR documentation built on April 17, 2025, 12:58 p.m.