View source: R/stap2duration.R
stap2duration | R Documentation |
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
).
stap2duration(stap_path, units = "days", return_numeric = TRUE)
stap_path |
A |
units |
character string. Units in which the results are desired. Can be abbreviated.
See |
return_numeric |
logical to return the duration as a numeric rather than with a duration format. |
vector of duration
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.