relabel_viewr_axes: Relabel the dimensions as length, width, and height

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

View source: R/utility_functions.R

Description

Axes are commonly labeled as "x", "y", and "z" in recording software yet pathviewr functions require these to be labeled as "length", "width", and "height". relabel_viewr_axes() is a function that takes a viewr object and allows the user to rename its variables.

Usage

1
2
3
4
5
6
7
8
relabel_viewr_axes(
  obj_name,
  tunnel_length = "_z",
  tunnel_width = "_x",
  tunnel_height = "_y",
  real = "_w",
  ...
)

Arguments

obj_name

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

tunnel_length

The dimension that corresponds to tunnel length. Set to tunnel_length = "_z" by default. Argument should contain a character vector with a leading underscore (see Details)

tunnel_width

The dimension that corresponds to tunnel width. Follows the same conventions as tunnel_length and defaults to tunnel_length = "_x"

tunnel_height

The dimension that corresponds to tunnel height. Follows the same conventions as tunnel_length and defaults to tunnel_length = "_y"

real

The dimension that corresponds to the "real" parameter in quaternion notation (for data with "rotation" values). Follows the same conventions as tunnel_length and defaults to real = "_w"

...

Additional arguments to be passed to read_motive_csv().

Details

Each argument must have a leading underscore ("_") and each argument must have an entry. E.g. tunnel_length = "_Y" will replace all instances of _Y with _length in the names of variables.

Value

A tibble or data.frame with variables that have been renamed.

Author(s)

Vikram B. Baliga

See Also

Other data cleaning functions: gather_tunnel_data(), get_full_trajectories(), quick_separate_trajectories(), redefine_tunnel_center(), rename_viewr_characters(), rotate_tunnel(), select_x_percent(), 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
library(pathviewr)

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

## Names of variables are labeled with _x, _y, _z, which we'd like to rename
names(motive_data)

## Now use relabel_viewr_axes() to rename these variables using _length,
## _width, and _height instead
motive_data_relabeled <-
  relabel_viewr_axes(motive_data,
                     tunnel_length = "_z",
                     tunnel_width = "_x",
                     tunnel_height = "_y",
                     real = "_w")

## See the result
names(motive_data_relabeled)

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