Skip to content

Commit

Permalink
Merge pull request #54 from thomvolker/main
Browse files Browse the repository at this point in the history
Plot all observed values, rather than non-(over)imputed values.
  • Loading branch information
hanneoberman committed May 17, 2022
2 parents 2ea1dbc + 2ad916d commit 8ca6dbd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/ggmice.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ ggmice <- function(data = NULL, mapping = ggplot2::aes()) {
}
if (mice::is.mids(data)) {
where_xy <- rowSums(as.matrix(data$where[, c(vrb_x, vrb_y)])) > 0L
miss_xy <- rowSums(as.matrix(is.na(data$data[, c(vrb_x, vrb_y)]))) > 0L
mice_data <- dplyr::mutate(
rbind(
data.frame(.where = "observed", .imp = 0, .id = rownames(data$data), data$data)[!where_xy, ],
data.frame(.where = "observed", .imp = 0, .id = rownames(data$data), data$data)[!miss_xy, ],
data.frame(.where = "imputed", mice::complete(data, action = "long"))[where_xy, ]
),
.imp = factor(.imp, ordered = TRUE)
Expand Down

0 comments on commit 8ca6dbd

Please sign in to comment.