Skip to content

Commit

Permalink
Fix for Issue #275
Browse files Browse the repository at this point in the history
enhance: added safety catch for NAs provided to `tune.spca()`.

It replaces NAs with 0 and notifies user of the change
  • Loading branch information
Max-Bladen committed Dec 5, 2022
1 parent 25d1d9e commit 88467ac
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/tune.spca.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ tune.spca <- function(X,

all.keepX <- test.keepX
names(all.keepX) <- paste0('keepX_', all.keepX)

if (any(is.na(X))) {
X[which(is.na(X))] <- 0
warning("There were NAs present in the input dataframe. These were converted to 0 values. If you don't want these as 0, handle missing values prior to tuning.", call. = F)
}

## ------ component loop
for(ncomp in seq_len(ncomp)) {
iter_keepX <- function(keepX.value) {
Expand Down

0 comments on commit 88467ac

Please sign in to comment.