processOpenSesameIAT(dataPath, blocks.sizes = c(18, 36, 48, 36, 48), blocks.congruent = c(2, 3), blocks.incongruent = c(4, 5), blocks.realTrials = c(3, 5), blocks.practiceTrials = c(2, 4), congruentLarger = TRUE, responseTime.min = 400, responseTime.max = 2500, responseTime.penalty = 600, outputFile = NULL, wideOutputFile = NULL, showLog = TRUE, filenameRegEx = "subject-(\\d+)(\\w+)\\.csv", regExValues = c("subject","session"), participantVarName = "subject", taskVarName = "session", openSesameVarNames = list(correct = "correct", response_time = "response_time"), stimulusSelectionVarName = NULL, stimulusSelectionValues = NULL, roundOutput = 6, decimalSeparator = ".", inputDecimalSeparator = ".", inputfileSelectionColumns = NULL, inputfileSelectionValues = NULL)
NULL
to process all files). Second,
by using "\1"
, "\2"
, etc, matched patterns can be
extracted from the filenames and stored as variables in the final
datafile (see sub
for more information on regular expression
matching). The default pattern, "subject-(\d+)(\w+)\.csv"
,
which is read by R as "subject-(\d+)(\w+)\.csv"
(because the
backslash is the escape symbol, double backspaces are needed to specify
one backspace, see Quotes
), assumes that all filenames start
with 'subject-'
, followed by the subject number ("\d+"
matches one or more digits), immediately followed by one or more letters
and digits ("\w+"
matches one or more letters or digits)
indicating the session that the datafile pertains to. If you only have
subject numbers, you'd use "subject-(\d+)\.csv"
or perhaps
"subject-(\w+)\.csv"
if the subjects could also have letters
in their identifiers. Note that you have to include the variable names
of each of these extractable patterns in regExValues
!
filenameRegEx
are provided. Must of course have the
same length as the number of patterns specified in filenameRegEx
,
and in the same order.
stimulusSelectionVarName
, and specify the value(s) to select in stimulusSelectionValues
.
read.csv
when reading the data files.
stimulusSelectionVarName
and stimulusSelectionValues
).
outputFile
and/or wideOutputFile
to just export the output files directly.
Note that this function was developed to read the OpenSesame IAT datafiles
created by the OpenSesame script developed by Kenny Wolfs, Jacques van
Lankveld, and Frederik van Acker at the Open University of the Netherlands.
If you use a different version (for example, the one contributed to the
OpenSesame paradigm repository by Hansika Kapoor, see
http://osdoc.cogsci.nl/3.0/standard-tasks/#implicit-association-test-iat),
you will have to specify the variable names you specified to OpenSesame
for the response time and for whether the response was correct in
openSesameVarNames
. For example, if you use Hansika's IAT task,
you'll have to specify openSesameVarNames = list(correct = "correct",
response_time = "avg_rt")
Similarly, of course you will probably have to specify the number of trials per block etc. Also, you may want to set showLog to FALSE, as the logging is quite detailed.
Kapoor, H. (2015). The creative side of the Dark Triad. Creativity Research Journal, 27(1), 58-67. doi:10.1080/10400419.2014.961775.
## Not run:
# ### This will process all files in the specified directory, but not
# ### export anything
# processed <- processOpenSesameIAT("C:/directory/with/datafiles");
#
# ### This will export both the aggregated datafile and the wide datafile
# processed <- processOpenSesameIAT("C:/directory/with/datafiles",
# outputFile="C:/directory/aggregated.csv",
# wideOutputFile="C:/directory/wide.csv");
#
# ## End(Not run)
Run the code above in your browser using DataLab