  We construct classifiers for multivariate and functional data. Our approach
is based on a kind of distance between data points and classes. The distance
measure needs to be robust to outliers and invariant to linear transformations
of the data. For this purpose we can use the bagdistance which is based on
halfspace depth. It satisfies most of the properties of a norm but is able to
reflect asymmetry when the class is skewed. Alternatively we can compute a
measure of outlyingness based on the skew-adjusted projection depth. In either
case we propose the DistSpace transform which maps each data point to the
vector of its distances to all classes, followed by k-nearest neighbor (kNN)
classification of the transformed data points. This combines invariance and
robustness with the simplicity and wide applicability of kNN. The proposal is
compared with other methods in experiments with real and simulated data.
