[Deprecated]

Re-represent each trajectory spatially using a constant number of points so that adjacent points on the trajectory become equidistant to each other. Please note that this function is deprecated and that mt_length_normalize should be used instead.

mt_spatialize(
  data,
  use = "trajectories",
  dimensions = c("xpos", "ypos"),
  save_as = "sp_trajectories",
  n_points = 20
)

Arguments

data

a mousetrap data object created using one of the mt_import functions (see mt_example for details). Alternatively, a trajectory array can be provided directly (in this case use will be ignored).

use

a character string specifying which trajectory data should be used.

dimensions

a character string specifying which trajectory variables should be used. Can be of length 2 or 3 for two-dimensional or three-dimensional data.

save_as

a character string specifying where the resulting trajectory data should be stored.

n_points

an integer or vector of integers specifying the number of points used to represent the spatially rescaled trajectories. If a single integer is provided, the number of points will be constant across trajectories. Alternatively, a vector of integers can provided that specify the number of points for each trajectory individually.

Value

A mousetrap data object (see mt_example) with an additional array containing the spatialized trajectories. If a trajectory array was provided directly as data, only the spatialized trajectories will be returned.

Details

mt_spatialize is used to emphasize the trajectories' shape. Usually, the vast majority of points of a raw or a time-normalized trajectory lie close to the start and end point. mt_spatialize re-distributes these points so that the spatial distribution is uniform across the entire trajectory. mt_spatialize is mainly used to improve the results of clustering (in particular mt_cluster) and visualization.

Author

Dirk U. Wulff

Jonas M. B. Haslbeck

Examples

if (FALSE) {
KH2017 <- mt_spatialize(data=KH2017,
  dimensions = c('xpos','ypos'),
  n_points = 20)
}