Last active
July 13, 2017 04:45
-
-
Save statzhero/6122484 to your computer and use it in GitHub Desktop.
A function to make analysing a random subset easier.
This file contains 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
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