# \donttest{
set.seed(123)
x_test <- matrix(rnorm(60), 10, 6)
colnames(x_test) <- paste0("X", 1:6)
x_test[1:2, 1] <- NA # Introduce missing values
x_train <- matrix(rnorm(300), 50, 6)
colnames(x_train) <- paste0("X", 1:6)
model <- list(imputed = c(1))
attr(model, "imputed") <- c(1)
x_imputed <- impute_x_pred(model, x_test, x_train)
dim(x_imputed) # 10 rows, 7 columns (6 original + 1 missingness indicator)
any(is.na(x_imputed)) # FALSE, no missing values
# }
Run the code above in your browser using DataLab