Retain trajectories that span a selected region of interest
Source:R/utility_functions.R
get_full_trajectories.Rd
Specify a minimum span of the selected region of interest and then keep trajectories that are wider than that span and go from one end to the other of the region.
Value
A viewr object (tibble or data.frame with attribute
pathviewr_steps
that includes "viewr"
) in which only
trajectories that span the region of interest are retained. Data are
labeled by direction (either "leftwards" or "rightwards") with respect to
their starting and ending position_length
values in the
direction
column.
Details
Because trajectories may not have observations exactly at the
beginning or the end of the region of interest, it may be necessary to allow
trajectories to be slightly shorter than the range of the selected region of
interest. The span
parameter of this function handles this. By
supplying a numeric proportion from 0 to 1, a user may allow trajectories to
span that proportion of the selected region. For example, setting span
= 0.95
will keep all trajectories that span 95% of the length of the
selected region of interest. Setting span = 1
(not recommended) will
strictly keep trajectories that start and end at the exact cut-offs of the
selected region of interest. For these reasons, span
s of 0.99 to 0.95
are generally recommended.
See also
Other data cleaning functions:
gather_tunnel_data()
,
quick_separate_trajectories()
,
redefine_tunnel_center()
,
relabel_viewr_axes()
,
rename_viewr_characters()
,
rotate_tunnel()
,
select_x_percent()
,
separate_trajectories()
,
standardize_tunnel()
,
trim_tunnel_outliers()
,
visualize_frame_gap_choice()
Other functions that define or clean trajectories:
quick_separate_trajectories()
,
separate_trajectories()
,
visualize_frame_gap_choice()
Examples
motive_data <-
read_motive_csv(system.file("extdata", "pathviewr_motive_example_data.csv",
package = 'pathviewr'))
## Clean the file. It is generally recommended to clean up to the
## "separate" step before running select_x_percent().
motive_separated <-
motive_data %>%
relabel_viewr_axes() %>%
gather_tunnel_data() %>%
trim_tunnel_outliers() %>%
rotate_tunnel() %>%
select_x_percent(desired_percent = 50) %>%
separate_trajectories(max_frame_gap = "autodetect",
frame_rate_proportion = 0.1)
#> autodetect is an experimental feature -- please report issues.
## Now retain only the "full" trajectories that span
## across 0.95 of the range of position_length
motive_full <-
motive_separated %>%
get_full_trajectories(span = 0.95)