two tests for dummy and use <- instead of =. Not sure why the sort is necessary? Mike: Please add a comment explaining it. (And remove my questions.)