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
stratified = function(df, group, size) { | |
# USE: * Specify your data frame and grouping variable (as column | |
# number) as the first two arguments. | |
# * Decide on your sample size. For a sample proportional to the | |
# population, enter "size" as a decimal. For an equal number | |
# of samples from each group, enter "size" as a whole number. | |
# | |
# Example 1: Sample 10% of each group from a data frame named "z", | |
# where the grouping variable is the fourth variable, use: | |
# |