Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jhelvy committed Feb 18, 2023
1 parent 41998ab commit 0592749
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# logitr (development version)

- Added a startup message when the package is loaded
- Fixed bug in adjustFactorLevels where the levels_orig object was being accidentally overwritten

# logitr 1.0.0

Expand Down
6 changes: 3 additions & 3 deletions R/predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ adjustFactorLevels <- function(object, newdata) {
for (i in 1:length(factorLevels)) {
par <- names(factorLevels)[[i]]
levels_new <- factorLevels[[i]]
levels_orig <- levels_orig[[par]]
if (! identical(levels_new, levels_orig)) {
newdata[[par]] <- factor(newdata[[par]], levels = levels_orig)
levels_old <- levels_orig[[par]]
if (! identical(levels_new, levels_old)) {
newdata[[par]] <- factor(newdata[[par]], levels = levels_old)
}
}
}
Expand Down

0 comments on commit 0592749

Please sign in to comment.