prep_data: Check the classes of specific columns and re-assigns as...

Description Usage Arguments Value Examples

View source: R/formatting.R

Description

prep_data converts the data frame to a data table and examines the required columns (RECORDING_SESSION_LABEL, LEFT_INTEREST_AREA_ID, RIGHT_INTEREST_AREA_ID, LEFT_INTEREST_AREA_LABEL, RIGHT_INTEREST_AREA_LABEL, TIMESTAMP, and TRIAL_INDEX) and optional columns (SAMPLE_MESSAGE, LEFT_GAZE_X, LEFT_GAZE_Y, RIGHT_GAZE_X, and RIGHT_GAZE_Y). It renames the subject and item columns, ensures required/optional columns are of the appropriate data class, and creates a new column called Event which indexes each unique series of samples corresponding to the combination of Subject and TRIAL_INDEX (can be changed), necessary for performing subsequent operations.

Usage

1
2
3
4
5
6
prep_data(
  data,
  Subject = NULL,
  Item = NA,
  EventColumns = c("Subject", "TRIAL_INDEX")
)

Arguments

data

A data frame object created from an Eyelink Sample Report.

Subject

An obligatory string containing the column name corresponding to the subject identifier.

Item

An optional string containing the column name corresponding to the item identifier; by default, NA.

EventColumns

A vector specifying the columns which will be used for creating the Event variable; by default, Subject and TRIAL_INDEX.

Value

An object of type data table as described in tibble.

Examples

1
2
3
4
5
6
7
8
## Not run: 
# Typical DataViewer output contains a column called "RECORDING_SESSION_LABEL"
# corresponding to the subject.
# To prepare the data...
library(VWPre)
df <- prep_data(data = dat, Subject = "RECORDING_SESSION_LABEL", Item = "ItemCol")

## End(Not run)

VWPre documentation built on Nov. 30, 2020, 1:08 a.m.