locColSel=locCols[grep('(T|t)rack|ID|id',locCols)[1]]# index 1 at the end in case more matches; select 1st; matches TrackLabel, tracklabel, Track Label etc
locColSel=locCols[grep('(T|t)ime|Metadata_T',locCols)[1]]# index 1 at the end in case more matches; select 1st; matches RealTime, realtime, real time, etc.
# This might be removed entirely because all NA treatment happens in data4trajPlot
# Clustering should work with NAs present. These might result from data itself or from missing time point rows that were turned into NAs when dcast-ing from long format.
# Remove NA's
# na.interpolation from package imputeTS works with multidimensional data
# but imputation is performed for each column independently
# The matrix for clustering contains time series in rows, hence transposing it twice