Skip to content

Commit

Permalink
Merge pull request #16 from certara/covariate_requirement_validation
Browse files Browse the repository at this point in the history
Covariate requirement validation
  • Loading branch information
certara-irebai authored Sep 13, 2024
2 parents 3392333 + 847e7da commit c0047b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/generate_residuals_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ generate_residuals_plot <- function(data, result, pop_param, seed = 123) {
result_5folds <- result$result_5folds

# Check that covariates supplied by user exist in the data
data_validation(data, pop_params, cov_continuous, cov_factors)
data_validation(data, pop_param, cov_continuous, cov_factors)

# Select columns and generate data for XGBoost
dat <- col_select(data, pop_params, cov_continuous, cov_factors)
pop_params <- dat %>% dplyr::select(dplyr::all_of(pop_params))
Expand Down
13 changes: 13 additions & 0 deletions R/ml_cov_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@
#'
ml_cov_search <- function(data, pop_param, cov_continuous, cov_factors, seed = 123) {

if (missing(cov_continuous) &&
missing(cov_factors)) {
stop(
"No covariates specified. Use `cov_continuous` and/or `cov_factors` argument to specify covariates to include in `ml_cov_search()`."
)
}
if (missing(cov_continuous)) {
cov_continuous <- NULL
}
if (missing(cov_factors)) {
cov_factors <- NULL
}

# Check that covariates supplied by user exist in the data
data_validation(data, pop_param, cov_continuous, cov_factors)

Expand Down

0 comments on commit c0047b3

Please sign in to comment.