Skip to contents

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

Usage

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

Vikram B. Baliga

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
## "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)
#> [1] -1.235780  1.406689
range(motive_selected$position_length)
#> [1] -0.6605554  0.6605359