conditional_transform: conditional_transform

View source: R/conditional_transform.R

conditional_transformR Documentation

conditional_transform

Description

A function to perform conditional transformations of the x/y raw data. The function takes the dataframe and performs a single axis flip based on the values specified in the cond_column. The primary use of this function is to correct or normalise the data when counterbalancing stimulus placement within experiments (e.g., having a target stimulus appear on the left and right equally often)

Usage

conditional_transform(
  data,
  flip = c("x", "y"),
  cond_column,
  cond_values,
  resolution_x = 1920,
  resolution_y = 1080,
  message = TRUE
)

Arguments

data

a dataframe that includes columns x and y and the column specified in cond_column. Can be raw, fixation, or saccade data.

flip

either "x", to flip across vertical midline, or "y" to flip across horizontal midline

cond_column

a column name, on which the flips are conditional

cond_values

a single value or vector stating which values in con_column result in a flip

resolution_x

screen size in pixels for the x axis

resolution_y

screen size in pixels for the y axis

message

whether to output messages during function. Useful to turn off when using in a vectorised fashion where it is running multiple times

Value

a dataframe of the equivalent format as the input data

Examples

data <- combine_eyes(HCL)
data <- merge(data, HCL_behavioural)
conditional_transform(data, flip = "x",
                      cond_column = "cue_order",
                      cond_values = 2)

tombeesley/eyetools documentation built on Dec. 23, 2024, 12:36 a.m.