Barbara asked
And second, is there any command (e.g. assert) in order to check the
sort sequence and only in case of being unsorted sorts the data?
Nick Cox' reply indicated that unneeded sorts would not be performed.
But this part of her question remains, and it might be useful to know
how to do this: