amices / mice

Multivariate Imputation by Chained Equations
https://amices.org/mice/
GNU General Public License v2.0
424 stars 106 forks source link

mice doesn't handle complex variable names #630

Closed Ralayax closed 2 months ago

Ralayax commented 3 months ago

Describe the bug mice doesn't handle complex variable names (like variables with spaces or other strange characters)

To Reproduce

library(tidyverse)
library(mice)

mice::boys |>
  rename(`whooooo 151""1512` = tv) |>
  mutate(`this is a 'terrible varname....a` = 0) |> 
  mice::mice()

Expected behavior Should do multiple imputations

Additional context I will create a pull request adding backticks to variables inside the mice formulas to fix the issue