Mouse-tracking, the analysis of mouse movements in computerized experiments, is a method that is becoming increasingly popular in the cognitive sciences. The mousetrap package offers functions for importing, preprocessing, analyzing, aggregating, and visualizing mouse-tracking data.
Mouse-tracking, the analysis of mouse movements in computerized experiments, is a method that is becoming increasingly popular in the cognitive sciences. The
mousetrap package offers functions for importing, preprocessing, analyzing, aggregating, and visualizing mouse-tracking data. An overview of the functions in this package is given in the package description, which can be accessed with
package?mousetrap once the package has been installed.
mousetrap package is developed by Pascal Kieslich and Felix Henninger. It is published under the GNU General Public License (version 3). Please see the NEWS file for most recent changes.
devtoolspackage . The development version can be installed via
We thank Johanna Hepp for helpful comments on the documentation of this package and Monika Wiegelmann for testing a development version. This work was supported by the University of Mannheim’s Graduate School of Economic and Social Sciences, which is funded by the German Research Foundation.
verbose(+ set default to
dimensionsargument to explicitly specify the names of the columns in the trajectory array that contain the mouse positions. In most cases, the default is
c("xpos","ypos")as the x- and y-positions should be used. Note that in some functions (as specified in the documentation) the order of the labels matters, the first value will be taken as the label of the x-positions, the second as the label of the y-positions.
timestampsargument to explicitly specify the dimension in the trajectory array containing the timestamps.
mt_reshape) based on the
rownames. Therefore, the
mt_idcolumn in data.frames is not needed anymore - but is kept for the convenience of the user. The column is called
"mt_id"in import and measures functions.
mt_reshapeallows the user to specify the label of the
mt_calculate_deviationsare now called
create_results(that simplifies including the newly created trajectories or measures in the existing mousetrap data object).
reshape2functions are replaced with functions from the
dplyrpackages (and custom functions). Package dependencies were adjusted accordingly. As the
dplyrfunctions may introduce additional classes for the reshaped data (such as
tbl_df), a new argument (
convert_df) is introduced that converts the reshaped data to "pure" data.frames by default (thereby dropping additional classes).
mt_import_wide: Allow specifying several variables for the trial identifier in
mt_id_label. A a new ID variable will be created by combining the values of each variable.
mt_import_mousetrap: Make import more robust against variables with empty logs (warning message is returned in the end) (closes #5, thanks to @sbrockhaus).
mt_import_wide: Import any number of additional variables using
mt_import_long: Timestamps are no longer used for ordering if
mt_seq_labelis not provided. Instead, data will be imported in the order in which they were stored in
mt_import_long: Improved speed by relying on functions from the
mt_align_start: Introduction of
dimensionsargument and the corresponding arguments
ypos_end). This also fixes the internal bug that in
xpos_startwas passed on as
dimensions, enable function to work with an arbitrary number of dimensions.
mt_deviations: Vectorized function
point_to_linefor time speed up (closes #2, thanks to @sbrockhaus).
mt_measures: Allow for flexible dimension labels and rename all measures columns relating only to x- or y-positions depending on the values in dimensions (e.g.,
xpos_flips). Change column label
mt_measures: Simplify AUC calculation using the actual x- and y-positions . New AUC values correlate to 1.00 with old values in
mt_example, but in some cases extremely small differences are possible (maximum difference of 2.328e-10 in mt_example).
.funs, which is passed on to the aggregation function(
.funsalso allows for specifying several aggregation functions.
mt_plot_per_trajectory: New arguments
ylimfor specifying the axes limits explicitly and
axes_exactfor plotting exact axes.
mt_plot_per_trajectory: New arguments
fillfor plotting rectangles (usually representing the response buttons).
mt_plot(and related functions): New argument
pointsallows for plotting points.
mt_add_variables: add new variables to trajectory array.
mt_export_long: export mouse-tracking data in long format (wrapper for
mt_export_wide: export mouse-tracking data in wide format (wrapper for
mt_align_start: Fixed bug that
ypos_start) was passed on as
mt_average: Fixed bug that if intervals were specified explicitly using
intervals, the wrong interval size was used when averaging (the default size of 100 was used).
mt_align_startadjusts trajectories so that they have the same start position (wrapper for
mt_calculate_deviationscalculates the idealized trajectory and the perpendicular deviations of the actual trajectory from it for each position in the trajectory array
dataargument. In this case, the
useargument will be ignored and only the resulting trajectory array will be returned
mt_plot_riverbednow preserves factor levels for facets
mt_calculate_derivativesnow allows for custom dimension names using the
mt_plot_per_trajectorynow receives the file name as the first argument
mt_import_mousetrapnow offers possibility to combine several variables in mouse-tracking raw data
mt_plot_riverbednow allows for faceting
mt_check_resolutionnow offers possibility to check (relative) frequencies of desired timestamp differences
mt_plot_riverbedcan no longer be set via
y_label(but can be added using the
ylab(), see Examples)