how to use dplyr functions for data sampling