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

Add function to cleanup NA data on select() #39

Open
wleoncio opened this issue Jan 25, 2021 · 0 comments
Open

Add function to cleanup NA data on select() #39

wleoncio opened this issue Jan 25, 2021 · 0 comments

Comments

@wleoncio
Copy link
Collaborator

wleoncio commented Jan 25, 2021

Summary

Using cluster_gen() with select() leaves the unsampled PSUs as data frames filled with NAs. There could be an argument on cluster_gen to clean those up afterwards

MRE

set.seed(1)
df <- cluster_gen(
	n = select(sch = 1, cl = 2, st = 4),
	N = list(school = 2, class = c(3, 2), student = c(5, 4, 5, 5, 5)),
	n_X = 1,
	n_W = 1,
	verbose = FALSE
)
df

Observed output

Problematic part highlighted:

image

Expected output

Calling cluster_gen(..., cleanup=TRUE) would return a data frame without the NA-laden data frames.

lsasim version

2.0.2.9008

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

No branches or pull requests

1 participant