Skip to content

Commit

Permalink
Merge pull request #18 from certara/pmxrd_174_handling_na_when_printing
Browse files Browse the repository at this point in the history
PMXRD-174 handle NA values when printing
  • Loading branch information
certara-irebai authored Sep 27, 2024
2 parents c0047b3 + abd62d9 commit faf98b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/ml_cov_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ ml_cov_search <- function(data, pop_param, cov_continuous, cov_factors, seed = 1
}

# Final covariate selection with a voting mechanism
result_ML <- data.frame(cov_selected = rep(NA, length(pop_param)))
result_ML <- data.frame(cov_selected = rep("", length(pop_param)))
rownames(result_ML) <- pop_param

res <- t(result_5folds[,1:5])
Expand Down Expand Up @@ -188,7 +188,7 @@ ml_cov_search <- function(data, pop_param, cov_continuous, cov_factors, seed = 1
RMSE <- rep(NA,5)
RMSE_ref <- rep(NA,5)

if (is.na(result_ML[i, 1]) == FALSE){
if (result_ML[i, 1] != ""){
list_cov <- strsplit(gsub(" ", "", result_ML[i, 1]), ",")
x.selected_final <- as.matrix(dat_XGB %>% dplyr::select(dplyr::all_of(list_cov[[1]])))
folds <- caret::createFolds(seq(1,nrow(x.selected_final)), k = 5, list = TRUE, returnTrain = FALSE)
Expand Down Expand Up @@ -238,7 +238,7 @@ ml_cov_search <- function(data, pop_param, cov_continuous, cov_factors, seed = 1
for (i in pop_param) {
y_xgb <- log(dat_XGB[, i])

if (is.na(result_ML[i, 1]) == FALSE) {
if (result_ML[i, 1] != "") {
list_cov <- strsplit(gsub(" ", "", result_ML[i, 1]), ",")
x.selected_final <-
as.matrix(dat_XGB %>% dplyr::select(dplyr::all_of(list_cov[[1]])))
Expand Down

0 comments on commit faf98b7

Please sign in to comment.