trim_tunnel_outliers: Trim out artifacts and other outliers from the extremes of...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/utility_functions.R

Description

The user provides estimates of min and max values of data. This function then trims out anything beyond these estimates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
trim_tunnel_outliers(
  obj_name,
  lengths_min = 0,
  lengths_max = 3,
  widths_min = -0.4,
  widths_max = 0.8,
  heights_min = -0.2,
  heights_max = 0.5,
  ...
)

Arguments

obj_name

The input viewr object; a tibble or data.frame with attribute pathviewr_steps that includes "viewr" that has been passed through relabel_viewr_axes() and gather_tunnel_data() (or is structured as though it has been passed through those functions).

lengths_min

Minimum length

lengths_max

Maximum length

widths_min

Minimum width

widths_max

Maximum width

heights_min

Minimum height

heights_max

Maximum height

...

Additional arguments passed to/from other pathviewr functions

Details

Anything supplied to _min or _max arguments should be single numeric values.

Value

A viewr object (tibble or data.frame with attribute pathviewr_steps that includes "viewr") in which data outside the specified ranges has been excluded.

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(), select_x_percent(), separate_trajectories(), standardize_tunnel(), 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
## Import the example Motive data included in the package
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
## "gather" step before running trim_tunnel_outliers().
motive_gathered <-
  motive_data %>%
  relabel_viewr_axes() %>%
  gather_tunnel_data()

## Now trim outliers using default values
motive_trimmed <-
  motive_gathered %>%
  trim_tunnel_outliers(lengths_min = 0,
                       lengths_max = 3,
                       widths_min = -0.4,
                       widths_max = 0.8,
                       heights_min = -0.2,
                       heights_max = 0.5)

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