clean_iat: Prepare and clean IAT data.

Description Usage Arguments Value Examples

View source: R/clean_iat.R

Description

Select IAT blocks for the D-score computation and eventually save demographic data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
clean_iat(
  data,
  sbj_id = "participant",
  block_id = "blockcode",
  mapA_practice = "practice_MappingA",
  mapA_test = "test_MappingA",
  mapB_practice = "practice_MappingB",
  mapB_test = "test_MappingB",
  latency_id = "latency",
  accuracy_id = "correct",
  trial_id = NULL,
  trial_eliminate = NULL,
  demo_id = NULL,
  trial_demo = NULL
)

Arguments

data

Dataframe containing IAT data.

sbj_id

Column identifying participants' IDs. This variable can be a character, numeric, or factor.

block_id

String. Column identifying IAT blocks. The block_id variable should be a factor with each level identifying an IAT block.

mapA_practice

String. Label for the practice blocks of Mapping A (as it appears in the block_id variable).

mapA_test

String. Label for the test blocks of Mapping A (as it appears in the block_id variable).

mapB_practice

String. Label for the practice blocks of Mapping B (as it appears in the block_id variable).

mapB_test

String. Label for the test blocks of Mapping B (as it appears in the block_id variable).

latency_id

String. Column identifying response times (in millisecond). If the IAT had a built-in correction, latencies of the incorrect responses should be those inflated with the built-in correction.

accuracy_id

String. Column identifying the IAT accuracy responses. The accuracy_id variable should be a numeric variable identifying the correct responses (with 1) and the incorrect responses (with 0).

trial_id

Character. Column identifying the trials. Specify this only if you want to delete some specific trials.

trial_eliminate

Character or character vector. Label(s) identifying the trials in trial_id to eliminate.

demo_id

Character. Column identifying demographic blocks. It can be the same as block_id.

trial_demo

Character or character vector identifying the name of the blocks in demo_id containing the demographic information.

Value

List of dataframe.

data_keep

Dataframe with class iat_clean. The dataframe contains the data of the blocks specified in mapA_practice, mapA_test, mapB_practice, mapB_test. If you have specified the trials to eliminate through trial_eliminate, data_keep will contain the already cleaned dataset. This dataset should be passed to the computeD function.

data_eliminate

Dataframe containing all the discarded blocks and trials.

data_demo

Dataframe containing demographic variables. It will be present only if you specified the demo_id and trial_demo arguments.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data("raw_data") # load data
iat_cleandata <- clean_iat(raw_data, sbj_id = "Participant",
                          block_id = "blockcode",
                          mapA_practice = "practice.iat.Milkbad",
                          mapA_test = "test.iat.Milkbad",
                          mapB_practice = "practice.iat.Milkgood",
                          mapB_test = "test.iat.Milkgood",
                          latency_id = "latency",
                          accuracy_id = "correct",
                          trial_id = "trialcode",
                          trial_eliminate = c("reminder", "reminder1"),
                          demo_id = "blockcode",
                          trial_demo = "demo")
iat_data <- iat_cleandata[[1]] # select the first element of the list (IAT data)
head(iat_data)
demo_data <- iat_cleandata[[3]] # select the third element of the list
                            # (demographic data)
head(demo_data)

OttaviaE/implicitMeasures documentation built on Feb. 22, 2022, 2:05 p.m.