-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove duplicates in
vars_dict
and add pre-commit check to guard ag…
…ainst dupes (#36) * Remove duplicates in `vars_dict` and add pre-commit check to guard against future dupes * Update vars_dict data documentation * Rename validate-vars-dict -> check-vars-dict * Add Rscript shebang to check-vars-dict.R hook
- Loading branch information
1 parent
8b6f53e
commit a5449b9
Showing
6 changed files
with
25 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env Rscript | ||
# Script to check that the `vars_dict` data object is well-formed | ||
load("data/vars_dict.rda") | ||
|
||
# Check for duplicate model parameters | ||
non_na_model_vars <- subset( | ||
vars_dict, | ||
!is.na(var_name_model) | ||
)[c("var_name_model", "var_code", "var_value")] | ||
dupes <- non_na_model_vars[which(duplicated(non_na_model_vars)), ] | ||
|
||
if (nrow(dupes) > 0) { | ||
stop( | ||
"Duplicate var_name_model entries in vars_dict: ", | ||
paste(dupes$var_name_model, collapse = ", ") | ||
) | ||
} |