Created
January 25, 2015 18:13
-
-
Save mmparker/4575d1e6f74b5b3ee862 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| get_random_subset <- function(df, id, n_ids = 1, select = TRUE) { | |
| # Pick one ID to review | |
| random_id <- sample(df[ , id], size = n_ids) | |
| # Print it | |
| df[df[ , id] %in% random_id, select] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment