Releases: PascalKieslich/mousetrap
Releases · PascalKieslich/mousetrap
mousetrap 3.0.0
Announcements
- We are delighted that Dirk Wulff and Jonas Haslbeck have joined the
mousetrap
team! They are contributing a number of new functions, particularly for clustering and visualization. - The documentation of the
mousetrap
package can now also be found online at http://pascalkieslich.github.io/mousetrap/
General changes to existing functions
- Introduction of class
mousetrap
for mousetrap data objects (such asmt_example
). This facilitates, among other things, checking of the data class. - Change of dimension order for all trajectory arrays: The old order was 1) trials, 2) variables, 3) samples. The new order is 1) trials, 2) samples, 3) variables. All functions and example data have been modified accordingly.
- Many reshape, aggregation, export, and plotting functions now accept a trajectory array as direct input to
data
. - In case an analysis function adds measures to an existing data.frame, existing columns of the same name are now replaced and a warning is displayed (instead of merging the data.frames and adding generic suffixes).
- Arguments that were already deprecated and replaced (e.g.,
show_progress
was replaced withverbose
) have been removed.
Changes in specific functions
mt_align_start
: function is now vectorized and allows for optionally aligning to mean start position across
trials; default forsave_as
argument is set touse
.mt_space_normalize
: function is deprecated and replaced withmt_align_start_end
. It offers similar functionality but is vectorized and allows for optionally aligning to mean start/end position across trials.mt_resample
: now provides option to perform partial constant interpolation. Thanks to @sbrockhaus for the suggestion (cf. #7, #9).mt_derivatives
: now provides option to additionally return timestamp differences.mt_measures
: now optionally determines the number and duration of hovers (cf. #9), improved documentation and report of time measures (cf. #6).mt_plot
: introducedfacet_row
andfacet_col
arguments for faceting.mt_plot_add_rect
: internal change to avoid warning message (due to changes inggplot2
).mt_plot_riverbed
: explicitly remove zero frequencies instead of relying on the alpha parameter.
New functions
read_mt
: read MouseTracker raw data (.mt files).mt_align
: general purpose function for aligning and rescaling trajectories. For specific operations, you can rely on the specialized functionsmt_align_start
andmt_align_start_end
.mt_spatialize
: re-represent each trajectory spatially so that adjacent points become equidistant to each other.mt_add_trajectory
: add a new trajectory to a trajectory array.mt_bind
: join two trajectory arrays.mt_count
: count the number of observations for each trajectory.mt_angles
: calculate movement angles for trajectories.mt_distmat
: compute the distance matrix for each pair of trajectories.mt_cluster
: perform trajectory clustering with a specified number of clusters.mt_cluster_k
: estimate the optimal number of clusters using various methods.mt_map
: map trajectories onto a predefined set of prototype trajectories (a core set is provided inmt_prototypes
).
Bugs fixed
mt_measures
: make checks for timestamps > 0 and < 0 independent. Thanks to Regina Köhler for pointing this out.mt_plot_per_trajectory
: fix bug that all trajectories were plotted on each page (introduced through previous change inmt_reshape
). Thanks to Bence Palfi for discovering this.create_results
(internal function): Explicitly select mt_id column (instead of assuming that it is the first column - which is, e.g., often not the case indata[["data"]]
); ensure for caseoverwrite=FALSE
that function also works when multiple columns are merged and when all columns except mt_id are dropped beforehand.
Removed functions
read_mousetracker
: removed as it is recommended to directly import the MouseTracker raw data using the new functionread_mt
.mt_movement_angle
: removed as it is replaced with new and more general functionmt_angles
.mt_calculate_derivatives
,mt_calculate_deviations
,mt_calculate_measures
: removed as they were previously deprecated and replaced withmt_derivatives
,mt_deviations
,mt_measures
.
mousetrap 2.0.0
General changes to all existing functions
- Renamed
show_progress
argument toverbose
(+ set default toFALSE
). - Introduced
dimensions
argument to explicitly specify the names of the columns in the trajectory array that contain the mouse positions. In most cases, the default isc("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. - Introduced
timestamps
argument to explicitly specify the dimension in the trajectory array containing the timestamps. - Perform merging of trial and trajectory data (e.g., in
mt_subset
andmt_reshape
) based on therownames
. Therefore, themt_id
column 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_reshape
allows the user to specify the label of themt_id
column explicitly. - As a consequence of the previous changes: Removal of the internal variables
mt_variable_labels
andmt_id
. - Removed "calculate" from all mt_calculate functions:
mt_calculate_measures
,mt_calculate_derivatives
,mt_calculate_deviations
are now calledmt_measures
,mt_derivatives
,mt_deviations
. - Introduction of internal utils function
create_results
(that simplifies including the newly created trajectories or measures in the existing mousetrap data object). - Performance improvement of reshaping, aggregation, and visualization functions through internal changes in
mt_reshape
:base::merge
andreshape2
functions are replaced with functions from thetidyr
anddplyr
packages (and custom functions). Package dependencies were adjusted accordingly. As thedplyr
functions may introduce additional classes for the reshaped data (such asgrouped_df
andtbl_df
), a new argument (convert_df
) is introduced that converts the reshaped data to "pure" data.frames by default (thereby dropping additional classes).
Changes in specific functions
mt_import_mousetrap
,mt_import_long
,mt_import_wide
: Allow specifying several variables for the trial identifier inmt_id_label
. 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_long
,mt_import_wide
: Import any number of additional variables usingadd_labels
(closes #4).mt_import_long
: Timestamps are no longer used for ordering ifmt_seq_label
is not provided. Instead, data will be imported in the order in which they were stored inraw_data
.mt_import_long
: Improved speed by relying on functions from thetidyr
anddplyr
packages.mt_space_normalize
,mt_align_start
: Introduction ofdimensions
argument and the corresponding argumentsstart
andend
(deprecatexpos_start
/xpos_end
/ypos_start
/ypos_end
). This also fixes the internal bug that inmt_align_start
xpos_start
was passed on asypos_start
tomt_space_normalize
(instead ofypos_start
).mt_derivatives
: Renamedimension
argument todimensions
, enable function to work with an arbitrary number of dimensions.mt_deviations
: Vectorized functionpoint_to_line
for 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.,x_max
becomesxpos_max
,x_flips
becomesxpos_flips
). Change column labelxy_dist
tototal_dist
.mt_measures
: Simplify AUC calculation using the actual x- and y-positions . New AUC values correlate to 1.00 with old values inmt_example
, but in some cases extremely small differences are possible (maximum difference of 2.328e-10 in mt_example).mt_reshape
,mt_aggregate
,mt_aggregate_per_subject
: Replaceaggregation_function
argument with.funs
, which is passed on to the aggregation function(summarize_at
)..funs
also allows for specifying several aggregation functions.mt_plot_per_trajectory
: New argumentsxlim
andylim
for specifying the axes limits explicitly andaxes_exact
for plotting exact axes.mt_plot_per_trajectory
: New argumentsrect
,color
, andfill
for plotting rectangles (usually representing the response buttons).mt_plot
(and related functions): New argumentpoints
allows for plotting points.
New functions
mt_add_variables
: add new variables to trajectory array.mt_export_long
: export mouse-tracking data in long format (wrapper formt_reshape
).mt_export_wide
: export mouse-tracking data in wide format (wrapper formt_reshape
).
Bugs fixed
mt_align_start
: Fixed bug thatxpos_start
(instead ofypos_start
) was passed on asypos_start
tomt_space_normalize
.mt_average
: Fixed bug that if intervals were specified explicitly usingintervals
, the wrong interval size was used when averaging (the default size of 100 was used).
mousetrap 1.2.0
Changes
- New function
mt_align_start
adjusts trajectories so that they have the same start position (wrapper formt_space_normalize
) - New function
mt_calculate_deviations
calculates the idealized trajectory and the perpendicular deviations of the actual trajectory from it for each position in the trajectory array - For many functions, a trajectory array can now be provided directly via the
data
argument. In this case, theuse
argument will be ignored and only the resulting trajectory array will be returned mt_plot_riverbed
now preserves factor levels for facetsmt_calculate_derivatives
now allows for custom dimension names using theprefix
argumentmt_plot_per_trajectory
now receives the file name as the first argument
mousetrap 1.1.0
Changes
mt_import_mousetrap
now offers possibility to combine several variables in mouse-tracking raw datamt_plot_riverbed
now allows for facetingmt_check_resolution
now offers possibility to check (relative) frequencies of desired timestamp differences- Improved preprocessing of mouse-tracking raw data for
mt_import_mousetrap
- Change of default scale for fill in
mt_plot_riverbed
- Custom x and y axis labels for
mt_plot_riverbed
can no longer be set viax_label
andy_label
(but can be added using theggplot2
functionsxlab()
andylab()
, see Examples) - Minor fix in package documentation (#1) (thanks to @sbrockhaus)
- Minor fix in documentation of x/y reversals (thanks to Barnabás Szászi)
mousetrap 1.0.0
This is the first release of the mousetrap package.
We hope that the package enables users to easily import, preprocess, analyze, aggregate and visualize mouse-tracking data in R.
We are looking forward to your feedback!