plot_pattern error on all NA variable
victoriatascau opened this issue · comments
# Create the id column.
id <- c(1, 2, 3)
# Create the time point column.
mm <- c(1, 2, 3)
# Create the x column filled with NA.
x <- c(NA, NA, NA)
# Create the data frame.
df <- data.frame(id, mm, x)
# Calling the mice missing data pattern function.
md.pattern(df)
# Calling the ggmice missing data pattern function.
plot_pattern(df)
Here I am trying to plot the missing data patterns for the data set named df
using two equivalent functions. md.pattern
is the missing data pattern function from the mice package. With this given example, md.pattern
manages to plot the pattern (there is only 1 pattern), but plot_pattern
fails and outputs the following error:
> plot_pattern(df)
Error in `tidyr::pivot_longer()`:
! Can't subset columns that don't exist.
✖ Columns `id`, `mm`, and `x` don't exist.
Run `rlang::last_trace()` to see where the error occurred.
I have R version: 4.1.2, mice version: 3.15.0, and ggmice version: 0.0.1.
Hi @victoriatascau, thanks for your issue report! This should have been fixed in the current development version of ggmice
, v0.0.1.9000. You can install this version using:
devtools::install_github("amices/ggmice")
EDIT: re-opened, because the issue has not yet been fixed. Sorry!
Thank you! Fixed in #104
# Create the id column.
id <- c(1, 2, 3)
# Create the time point column.
mm <- c(1, 2, 3)
# Create the x column filled with NA.
x <- c(NA, NA, NA)
# Create the data frame.
df <- data.frame(id, mm, x)
# Calling the mice missing data pattern function.
mice::md.pattern(df)
#> id mm x
#> 3 1 1 0 1
#> 0 0 3 3
# Calling the ggmice missing data pattern function.
ggmice::plot_pattern(df)
Created on 2023-06-27 with reprex v2.0.2