Sort samples by group and optionally by time.
an abundance matrix with taxa as rows and samples as columns
group membership vector with as many entries as samples
optional time vector with as many entries as samples; entries are numeric or characters of numbers
option to order samples by group name in alphabetical order
an index vector with the updated sample order