All functions

add_angular_diff()

Add angular difference wrt reference direction to movement or eye tracker data frame

add_fixation2target()

Add target fixations to eyetracker data

add_gaze_elevation()

Add gaze elevation to (head) movement or eye tracker data frame

add_orientation2target()

Add direction of the orientation of a reference object relative to a stationary target (in 2D, XZ).

add_orientation2target2()

Add direction of the orientation of a reference object relative to a target movement (in 2D, XZ).

add_rot()

Add rotation matrix to movement or eye tracker data frame

add_rot_eye()

Helper function that takes an eye tracker data frame and adds a new column `R` with the rotation matrices.

add_rot_move()

Helper function that takes a movement data frame and adds a new column `R` with the rotation matrices.

add_speed()

Add movement speed to movement data frame

angle_between()

This uses R base functions to calculate the angle between two vectors in degrees, accounting for rounding errors to avoid NaNs.

angle_diff_deg()

Calculate angle difference in degrees, respecting angles <0 or >360.

apply_replacements()

Apply replacements using replacement data frame.

average_timeseries()

Average a list of resampled time series (movement, fruit collection or eyetracking) data frames

average_timeseries_cols()

Average time series data columns within group

calculate_2d_angle_deg()

Calculate 2D angle positive z-axis and a line from reference to target position in degrees

calculate_2d_dist()

Calculate 2D Euclidean distance between two positions

cart2sph()

Transform cartesian to spherical coordinates

check_tracker_cols()

Check movement data columns

check_valid_movement()

Check whether movement data frame contains valid tracker information

create_out_folders()

Create output folders under an experiment name

create_resampling_index()

Create resampling index at desired sample rate

create_threat_name()

Create threat name column from episode name

detect_sound()

Automatically detect sounds in audio recording using a volume/duration threshold

eulunity2rot()

Convert rotation in Unity Euler angles (in degrees) into 3D rotation matrix

extract_fixation()

Extract ratio of target fixation between a `min_time` and `max_time`. You can supply timestamps to `min_time` and `max_time` (e.g timestamp of begin escape) to average over only a period, or use the entire duration of the provided data frame.

extract_fruit_task()

Extract fruit picking between a `min_time` and `max_time`. You can supply timestamps to `min_time` and `max_time` (e.g timestamp of begin escape) to average over only a period. In this case, you can also retrieve the collection rate by setting `rate` to 1.

extract_gaze_elevation()

Extract gaze elevation between a `min_time` and `max_time`.

extract_movement2_dist()

Extract (min, max or) 2D distance between two movement trajectories.

extract_movement_dist()

Extract (min, max or mean) 2D distance between movement trajectory and reference position.

extract_orientation()

Extract direction of the orientation of a reference object relative to a stationary target (in 2D, XZ) between a `min_time` and `max_time`.

extract_orientation2()

Extract direction of the orientation of a reference object relative to a target movement (in 2D, XZ) between a `min_time` and `max_time`.

extract_speed()

Extract speed (peak or average speed) between a `min_time` and `max_time`.

extract_speed_angular()

Extract angular speed (peak or average speed) for a direction vector between a `min_time` and `max_time`.

extract_timestamp_duplicates()

Extract duplicated time stamps.

find_fruit_position()

Find fruit position

find_hierarchy_object()

Find Hierarchy Object

find_hierarchy_object_any()

Find Hierarchy Object Matching Any Name

find_initial_threat_position()

Find initial threat position from programmatic scenario planner

find_log_message()

Find messages in a session log and assign to trials

find_safe_position()

Find safe position

find_start_position()

Find Start marker position and rotation

find_unity_threat_name()

Find Unity's internal threat name

fit_mdl()

Fit (generalised) linear model, checking for convergence, and obtain marginal means

fit_mdl_robust()

Fit (generalised) linear random effects model robustly, checking for convergence

fix_old_names()

Fixes names in older versions of the output. Specifically, deletes the occurance of `"vrthreat_"` in any column names.

fruit_gameobject_names

Common fruit object names used in VRthreat Unity

get_first_fruit_collection()

Get time of first fruit collection

get_time_of_first_event()

Get Time Of First Sequence Event

guess_escape_abortion()

Guess escape abortion position and time

guess_escape_begin_time()

Guess start of escape

guess_escape_end_time()

Guess end of escape time

guess_move_from_pos()

Guess First Move From Position

guess_pos_at_time()

Guess/interpolate position at a point in time

play_audio_from_threat()

Play audio recording from threat appearance to the end

play_audio_section()

Play audio section

plot_3D_movement()

Plot 3D movements for one trial

prepare_gaze_data()

Prepare gaze data for further processing

proj_vec2plane()

Project 3D-vector x into the plane spanned by y and z

proj_vec2vec()

Project vector x onto vector y

read_csv_files()

Read CSV Files

read_json_files()

Read JSON Files

read_log_messages()

Read log messages

read_participant_details()

Read participant details from files

read_quest_data()

Read and score questionnaire data

read_quest_raw()

Read raw (csv) questionnaire data

read_study_data()

Read complete study data

read_trial_results()

Read Trial Results

remove_tld()

Remove top-level directory in a full file path.

remove_tutorials()

Remove tutorial trials - i.e. episode either containing "Tutorial" or "Practice"

reorient_movement_cols_to_start()

Reorient movement columns to starting position.

reorient_movement_to_start()

Reorient movement data frame such that initial values match start position and orientation

replace_redcapid_ppid()

Replace Redcap id in questionnaires by VR ppid

resample_eyetracker()

Resample an eyetracker data frame to new time index.

resample_eyetracker_cols()

Resample eyetracker data columns

resample_filter_pos()

Resample and median-filter position and rotation columns in a movement data frame

resample_fruit_task()

Resample a fruit collection frame to new time index.

resample_fruit_task_cols()

Resample fruit task data columns

resample_movement()

Resample a movement data frame to new time index.

resample_movement_cols()

Resample movement data columns

rot2centralangle()

Compute central angle between two rotation matrices, for a direction vector

save_fig()

Wrapper around `ggsave` to save figures.

scale_pastel()

Pastel colored ggplot scale

scale_vrthreat_endstate()

VR Threat End State ggplot scale

scale_vrthreat_planningtime()

VR Threat Planning Time ggplot scale

scale_vrthreat_scenariotype()

VR Threat Scenario Type ggplot scale

sound_classification_manual()

Manually classify sounds

split_path()

Split a path name into into its components

sub_sum_quest()

Get sum of a questionnaire subscale

summarise_movement()

Summarise movement data frame for each unique time stamp

summarise_movement_cols()

Summarise movement data columns to ensure unique time stamps

sum_mssq()

Get MSSQ subscale score (Motion Sickness; Golding, 2006)

sum_quest()

Get sum of a questionnaire if questionnaire exists

theme_vrthreat()

VR Threat ggplot theme #'

timeseries_mean()

Compute the mean across a vector `x` respecting time `t`, using trapezium rule.

translate_movement_to_ref()

Translate positions in movement data frame to reference position.

update_file_pointers()

Update file pointers

vec2rot()

Find a rotation matrix that maps one vector onto the other