insight icon indicating copy to clipboard operation
insight copied to clipboard

`clean_names()` on string with nested `I()` and `scale()`

Open strengejacke opened this issue 1 year ago • 0 comments

library(data.table)
library(gamlss)
set.seed(123)
dat <- data.frame(
  Y = sample(20:50, 100, replace = T),
  date = sample(seq(as.Date('1999/01/01'), as.Date('2000/01/01'), by = "day"), 10),
  cont1 = rchisq(100, df = 2), 
  cont2 = runif(100), 
  cat1 = sample(LETTERS[1:3], 100, replace = T)
)
mod1 <- gamlss(
  Y ~ date + scale(cont1) + scale(cont2) + I(scale(cont2)^2) * cat1, 
  data = dat, 
  family = GB2
)
insight::clean_names(mod1)
#> [1] "Y"     "date"  "cont1" "cont2" "cat1"

insight::clean_names(insight::find_terms(mod1)$conditional)
#> [1] "date"  "cont1" "cont2" "scale" "cat1"

Created on 2024-10-23 with reprex v2.1.1

strengejacke avatar Oct 23 '24 09:10 strengejacke