Re-write of ncc_sample with data.table functions to speed things up