Function unique() man page states that: "The array method calculates for each element of the dimension specified by MARGIN if the remaining dimensions are identical to those for an earlier element (in row-major order). " I think that the last precission: "(in row-major order)" is meaningless here, as the function is dividing the array in just one axis: the specified in the MARGIN argument. This MARGIN is rows by default, but this has nothing to do with the concept of : "row-major-order". This issue is related to the one reported in: https://stat.ethz.ch/pipermail/r-help/2019-May/462620.html