select_x_percent: Select a region of interest within the tunnel

Description Usage Arguments Value Author(s) See Also Examples

View source: R/utility_functions.R

Description

Select data in the middle X percent of the length of the tunnel

Usage

1
select_x_percent(obj_name, desired_percent = 33, ...)

Arguments

obj_name

The input viewr object; a tibble or data.frame with attribute pathviewr_steps that includes "viewr"

desired_percent

Numeric, the percent of the total length of the tunnel that will define the region of interest. Measured from the center outwards.

...

Additional arguments passed to/from other pathviewr functions

Value

A viewr object (tibble or data.frame with attribute pathviewr_steps that includes "viewr") in which data outside the region of interest have been removed.

Author(s)

Vikram B. Baliga

See Also

Other data cleaning functions: gather_tunnel_data(), get_full_trajectories(), quick_separate_trajectories(), redefine_tunnel_center(), relabel_viewr_axes(), rename_viewr_characters(), rotate_tunnel(), separate_trajectories(), standardize_tunnel(), trim_tunnel_outliers(), visualize_frame_gap_choice()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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
## "trimmed" step before running rotate_tunnel().
motive_rotated <-
  motive_data %>%
  relabel_viewr_axes() %>%
  gather_tunnel_data() %>%
  trim_tunnel_outliers() %>%
  rotate_tunnel()

## Now select the middle 50% of the tunnel
motive_selected <-
  motive_rotated %>%
  select_x_percent(desired_percent = 50)

## Compare the ranges of lengths to see the effect
range(motive_rotated$position_length)
range(motive_selected$position_length)

pathviewr documentation built on May 6, 2021, 9:07 a.m.