stap2flight | R Documentation |
Convert a stationary period data.frame stap
into a flight data.frame or list. Flight are
computed as the difference between the end of a stationary period to the start of the next one.
Because the pressure/acceleration is labelled for "in flight", the bird was already in flight
before the first label and after the last label. We account for this by adding to all flights
duration half the temporal resolution of the sensor.
You can compute the flight between specific stationary periods using include_stap_id
. In this
case, the flight duration is computed as the sum of individual flights in between.
You can return the flight as a data.frame or as a list if you want to retrieve the information
of all individual flight between the include_stap_id
.
stap2flight(
stap,
include_stap_id = NULL,
format = "df",
units = "hours",
return_numeric = TRUE
)
stap |
a stationary period data.frame (see |
include_stap_id |
vector of the stationary period |
format |
character to return a list |
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. |
A list or a data.frame (see description) containing
start
: Start time of the (first) flight
end
: End time of the (last) flight
stap_id_s
: Source stap_id (i.e, start)
stap_id_t
: Target stap_id (i.e, end)
duration
: (Sum of the) duration of flight(s)
(n
: Number of flights)
The value in brackets are only for the data.frame
withr::with_dir(system.file("extdata", package = "GeoPressureR"), {
tag <- tag_create("18LX", quiet = TRUE) |> tag_label(quiet = TRUE)
})
# By default, return a data.frame of all individual flights
knitr::kable(stap2flight(tag$stap))
# Compute the total flight between stap 1,3 and 5. Sum flight duration in between.
knitr::kable(stap2flight(tag$stap, include_stap_id = c(1, 3, 5)))
# Can also return as a list of data.frame to access individual flights information.
knitr::kable(stap2flight(tag$stap,
include_stap_id = c(1, 3, 5), format = "list",
units = "secs"
))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.