Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sampling with replacement not working as expected #70

Open
dlenar opened this issue Oct 31, 2019 · 0 comments
Open

sampling with replacement not working as expected #70

dlenar opened this issue Oct 31, 2019 · 0 comments

Comments

@dlenar
Copy link

dlenar commented Oct 31, 2019

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant