Skip to content

Commit

Permalink
Do not try to fill imp for complete variables
Browse files Browse the repository at this point in the history
  • Loading branch information
stefvanbuuren committed Oct 3, 2024
1 parent cbc6c4a commit 18e9745
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Prevent `as.mids()` from filling the `imp` object for complete variables

# mice 3.16.15

* Initialize single-variables blocks in `make.method()` in a more efficient way (resolves #672)
Expand Down
2 changes: 1 addition & 1 deletion R/as.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ as.mids <- function(long, where = NULL, .imp = ".imp", .id = ".id") {
names <- names(ini$imp)
for (i in seq_along(names)) {
varname <- names[i]
if (!is.null(ini$imp[[varname]])) {
if (nrow(ini$imp[[varname]])) {
for (j in seq_len(m)) {
idx <- imps == j & where[, varname]
ini$imp[[varname]][j] <- long[idx, varname]
Expand Down

0 comments on commit 18e9745

Please sign in to comment.