clean_viewr: All-in-one function to clean imported objects

View source: R/all_in_one_functions.R

clean_viewrR Documentation

All-in-one function to clean imported objects

Description

For an imported viewr object, run through the cleaning pipeline as desired

Usage

clean_viewr(
  obj_name,
  relabel_viewr_axes = TRUE,
  gather_tunnel_data = TRUE,
  trim_tunnel_outliers = TRUE,
  standardization_option = "rotate_tunnel",
  get_velocity = TRUE,
  select_x_percent = TRUE,
  rename_viewr_characters = FALSE,
  separate_trajectories = TRUE,
  get_full_trajectories = TRUE,
  fill_traj_gaps = FALSE,
  ...
)

Arguments

obj_name

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

relabel_viewr_axes

default TRUE, should axes be relabeled?

gather_tunnel_data

default TRUE, should tunnel data be gathered?

trim_tunnel_outliers

default TRUE, outliers be trimmed?

standardization_option

default "rotate_tunnel"; which standardization option should be used? See Details for more.

get_velocity

default TRUE, should velocity be computed?

select_x_percent

default TRUE, should a region of interest be selected?

rename_viewr_characters

default FALSE, should subjects be renamed?

separate_trajectories

default TRUE, should trajectories be defined?

get_full_trajectories

default TRUE, should only full trajectories be retained?

fill_traj_gaps

default FALSE, should gaps in trajectories be filled?

...

Additional arguments passed to any of the corresponding functions

Details

Each argument corresponds to a standalone function in pathviewr. E.g. the parameter relabel_viewr_axes allows a user to choose whether pathviewr::relabel_viewr_axes() is run internally. Should the user desire to use any non-default parameter values for any functions included here, they should be supplied to this function as additional arguments formatted exactly as they would appear in their corresponding function(s). E.g. if the "autodetect" feature in pathviewr::separate_trajectories() is desired, add an argument max_frame_gap = "autodetect" to the arguments supplied to this function.

Value

A viewr object (tibble or data.frame with attribute pathviewr_steps that includes "viewr") that has passed through several pathviewr functions as desired by the user, resulting in data that have been cleaned and ready for analyses.

Author(s)

Vikram B. Baliga

See Also

Other all in one functions: import_and_clean_viewr()

Examples

library(pathviewr)

## Import the example Motive data included in the package
motive_data <-
  read_motive_csv(system.file("extdata", "pathviewr_motive_example_data.csv",
                             package = 'pathviewr'))

motive_full <-
  motive_data %>%
  clean_viewr(desired_percent = 50,
              max_frame_gap = "autodetect",
              span = 0.95)

## Alternatively, used the import_and_clean_viewr()
## function to combine these steps
motive_import_and_clean <-
  import_and_clean_viewr(
    file_name = system.file("extdata", "pathviewr_motive_example_data.csv",
                            package = 'pathviewr'),
    desired_percent = 50,
    max_frame_gap = "autodetect",
    span = 0.95
  )

vbaliga/pathviewR documentation built on March 16, 2023, 4:13 p.m.