specgroups function

Average within-group distances for given groups