clean_iat {implicitMeasures} | R Documentation |
Prepare and clean IAT data.
Description
Select IAT blocks for the D-score computation and eventually save demographic data.
Usage
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 |
block_id |
String. Column identifying
IAT blocks. The |
mapA_practice |
String. Label for the practice blocks of Mapping A (as
it appears in the |
mapA_test |
String. Label for the test blocks of Mapping A (as
it appears in the |
mapB_practice |
String. Label for the practice blocks of Mapping B (as
it appears in the |
mapB_test |
String. Label for the test blocks of Mapping B (as
it appears in the |
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 |
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 |
demo_id |
Character. Column identifying demographic blocks. It can be the same as |
trial_demo |
Character or character vector identifying the name of the
blocks in |
Value
List of dataframe.
data_keep
Dataframe with class
iat_clean
. The dataframe contains the data of the blocks specified inmapA_practice
,mapA_test
,mapB_practice
,mapB_test
. If you have specified the trials to eliminate throughtrial_eliminate
,data_keep
will contain the already cleaned dataset. This dataset should be passed to thecomputeD
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
andtrial_demo
arguments.
Examples
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)