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

Edit checks for weight cols and id cols in hts_prep_variable #168

Open
ashleyasmus opened this issue Jun 28, 2024 · 0 comments
Open

Edit checks for weight cols and id cols in hts_prep_variable #168

ashleyasmus opened this issue Jun 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ashleyasmus
Copy link
Collaborator

This check fails for my dataset:

# Check that there is a id and weight for every table
if (length(data) != length(id_cols)) {
stop("Each table in data must have a corresponding id in id_cols")
}
if (weighted) {
if (length(data) != length(wt_cols)) {
stop("Each table in data must have a corresponding weight in wt_cols")
}
}

The check should not look at the length of the id columns, but rather that each table in hts_data has an id in id_cols.
Something like:

missing_ids = lapply(hts_data, function(x) length(names(x)[names(x) %in% id_cols])==0)
any(unlist(missing_ids))

missing_wts = lapply(hts_data, function(x) length(names(x)[names(x) %in% wt_cols])==0)
any(unlist(missing_wts ))

@ashleyasmus ashleyasmus added the bug Something isn't working label Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant