mt_average(data, use = "trajectories", save_as = "av_trajectories", dimensions = "all", av_dimension = "timestamps", intervals = NULL, interval_size = 100, max_interval = NULL, verbose = FALSE, dimension = NULL, show_progress = NULL)use will be ignored)."all"), all
trajectory dimensions will be averaged."timestamps" by
default).interval_size and
max_interval are ignored).interval_size). If specified, only values will be used for
averaging where the dimension values are smaller than max_interval.
If unspecified (the default), all values will be included.av_dimension instead.verbose instead.av_trajectories) that contains the average
trajectory data per dimension interval. If a trajectory array was provided
directly as data, only the average trajectories will be returned.For the dimension values used for averaging (specified in
av_dimension), the mid point of the respective interval is reported,
which is helpful for plotting the trajectory data later on. However, this
value does not necessarily correspond to the empirical mean of the
dimension values in the interval.
In case the last interval is not fully covered (e.g., if the last timestamp has the value 1250), values for the corresponding interval (1200-1300) will be computed based on the average of the values up to the last existing value.
Note that mt_average assumes that the trajectory variables are
recorded with a constant sampling rate (i.e., with a constant difference in
the timestamps). If the sampling rate varies considerably, mt_resample
should be called before averaging to arrive at equally spaced timestamps. The
sampling rate can be investigated using mt_check_resolution.
If average velocity and acceleration are of interest, mt_derivatives should be called before averaging.
mt_resample for resampling trajectories using a constant time interval.
mt_example <- mt_derivatives(mt_example)
# average trajectories across 100 ms intervals
mt_example <- mt_average(mt_example, save_as="av_trajectories",
interval_size=100)
# average time-normalized trajectories across specific intervals
# of the time steps
mt_example <- mt_time_normalize(mt_example)
mt_example <- mt_average(mt_example,
use="tn_trajectories", save_as="av_tn_trajectories",
av_dimension = "steps", intervals = c(0.5,33.5,67.5,101.5))
Run the code above in your browser using DataLab