Sort samples by group and optionally by time.

sortSamples(abundances, groups = c(), time = c(), alphabetical = FALSE)

Arguments

abundances

an abundance matrix with taxa as rows and samples as columns

groups

group membership vector with as many entries as samples

time

optional time vector with as many entries as samples; entries are numeric or characters of numbers

alphabetical

option to order samples by group name in alphabetical order

Value

an index vector with the updated sample order