subsample function

Subsample a dataset