Skip to content

Instantly share code, notes, and snippets.

@statzhero
Last active July 13, 2017 04:45
Show Gist options
  • Save statzhero/6122484 to your computer and use it in GitHub Desktop.
Save statzhero/6122484 to your computer and use it in GitHub Desktop.
A function to make analysing a random subset easier.
row.sample <- function(dta, rep = 20) {
dta <- as.data.frame(dta) # for single variables
dta[sample(1:nrow(dta), rep, replace=FALSE), ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment