Skip to content

Instantly share code, notes, and snippets.

@mmparker
Created January 25, 2015 18:13
Show Gist options
  • Select an option

  • Save mmparker/4575d1e6f74b5b3ee862 to your computer and use it in GitHub Desktop.

Select an option

Save mmparker/4575d1e6f74b5b3ee862 to your computer and use it in GitHub Desktop.
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