R script to subsample NSBP data