Skip to content

sampling with replacement not working as expected #70

Description

@dlenar

This code produces the warning "Groups F NY AA, F CA DD, M TX BB, M CA DD contain fewer rows than requested. Returning all rows." Each of the groups listed has 1 row in DF. With replace=TRUE I expect this row to be selected twice, but it is only selected one time.

set.seed(2)
DF <- data.frame(
ID = 1:100,
A = sample(c("AA", "BB", "CC", "DD", "EE"), 100, replace = TRUE),
B = rnorm(100),
C = abs(round(rnorm(100), digits=1)),
D = sample(c("CA", "NY", "TX"), 100, replace = TRUE),
E = sample(c("M", "F"), 100, replace = TRUE))

stratified(DF, c("E", "D", "A"), size = 2, replace=TRUE)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions