Skip to content

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

@wleoncio

Description

@wleoncio

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions