Skip to content

Commit

Permalink
Merge pull request #589 from vkhodygo/quickpred
Browse files Browse the repository at this point in the history
ENH: skip missing data pattern check when `minpuc` == 0
  • Loading branch information
stefvanbuuren authored Oct 6, 2023
2 parents 954e6c6 + 81b5cea commit 538f614
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/quickpred.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ quickpred <- function(data, mincor = 0.1, minpuc = 0, include = "",
predictorMatrix[maxc > mincor] <- 1

# exclude predictors with a percentage usable cases below minpuc
p <- md.pairs(data)
puc <- p$mr / (p$mr + p$mm)
predictorMatrix[puc < minpuc] <- 0
if (minpuc != 0) {
p <- md.pairs(data)
puc <- p$mr / (p$mr + p$mm)
predictorMatrix[puc < minpuc] <- 0
}

# exclude predictors listed in the exclude argument
yz <- pmatch(exclude, names(data))
Expand Down

2 comments on commit 538f614

@stephematician
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces an error whenever minpuc is non-scalar.

@stefvanbuuren
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your note.

I committed too soon, not realizing that this change would break when minpuc is a vector or matrix.

Agree that we need a fix.

Please sign in to comment.