Skip to content

Commit

Permalink
Extend documentation output ggmice()
Browse files Browse the repository at this point in the history
  • Loading branch information
hanneoberman committed Dec 21, 2023
1 parent b6be179 commit 6b5863c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
12 changes: 9 additions & 3 deletions R/ggmice.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
#' @param data An incomplete dataset (of class `data.frame`), or an object of class [`mice::mids`].
#' @param mapping A list of aesthetic mappings created with [ggplot2::aes()].
#'
#' @return An object of class [`ggplot2::ggplot`].
#' @return An object of class [`ggplot2::ggplot`]. The [`ggmice::ggmice`] function returns output
#' equivalent to [`ggplot2::ggplot`] output, with a few important exceptions:
#'
#' - The theme is set to [`ggmice::theme_mice`].
#' - The color scale is set to the [`mice::mdc`] colors.
#' - The `colour` aesthetic is set to `.where`, an internally defined variable which distinguishes
#' observed data from missing data or imputed data (for incomplete and imputed data, respectively).
#'
#' @examples
#' dat <- mice::nhanes
Expand Down Expand Up @@ -101,8 +107,8 @@ ggmice <- function(data = NULL,
.imp = 0,
.id = rownames(data$data),
data$data
)[!miss_xy, ],
data.frame(.where = "imputed", mice::complete(data, action = "long"))[where_xy, ]
)[!miss_xy,],

Check warning on line 110 in R/ggmice.R

View workflow job for this annotation

GitHub Actions / lint

file=R/ggmice.R,line=110,col=20,[commas_linter] Commas should always have a space after.
data.frame(.where = "imputed", mice::complete(data, action = "long"))[where_xy,]

Check warning on line 111 in R/ggmice.R

View workflow job for this annotation

GitHub Actions / lint

file=R/ggmice.R,line=111,col=88,[commas_linter] Commas should always have a space after.
),
.where = factor(
.where,
Expand Down
9 changes: 8 additions & 1 deletion man/ggmice.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6b5863c

Please sign in to comment.