read_mt {mousetrap} | R Documentation |
Read MouseTracker raw data.
Description
read_mt
reads raw data that was collected using
MouseTracker (Freeman & Ambady, 2010)
and stored as a file in the ".mt" format. If multiple files should be read
into R, read_mt
can be used in combination with the
read_bulk function from the
readbulk package (see
Examples). After reading the data into R, mt_import_wide can be used
to prepare the trajectory data for analyses using the mousetrap library. The
current version of read_mt
has been tested with data from MouseTracker
Version 2.84 - but please be sure to double-check.
Usage
read_mt(file, columns = "all", add_trialid = FALSE, add_filename = FALSE)
Arguments
file |
a character string specifying the filename of the .mt file. |
columns |
either 'all' or a character vector specifying the to be extracted variables. Defaults to 'all' in which case all existing variables will be extracted. |
add_trialid |
boolean specifying whether an additional column containing the trial number should be added. |
add_filename |
boolean specifying whether an additional column containing the file name should be added. |
Value
A data.frame with one row per trial. Variables are ordered according to columns, x-coordinates, y-coordinates, and timestamps.
Author(s)
Dirk U. Wulff
References
Freeman, J. B., & Ambady, N. (2010). MouseTracker: Software for studying real-time mental processing using a computer mouse-tracking method. Behavior Research Methods, 42(1), 226-241.
See Also
read_bulk from the readbulk
package for reading and
combining multiple raw data files.
mt_import_wide to prepare the imported data for analyses in mousetrap.
Examples
## Not run:
# Read a single raw data file from MouseTracker
# (stored in the current working directory)
mt_data_raw <- read_mt("example.mt")
# Use read_bulk to read all raw data files ending with ".mt" that are
# stored in the folder "raw_data" (in the current working directory)
library(readbulk)
mt_data_raw <- read_bulk("raw_data", fun=read_mt, extension=".mt")
# Import the data into mousetrap
mt_data <- mt_import_wide(mt_data_raw)
## End(Not run)