IndrajeetPatil / ggstatsplot

Enhancing {ggplot2} plots with statistical analysis 📊📣
https://indrajeetpatil.github.io/ggstatsplot/
GNU General Public License v3.0
1.98k stars 184 forks source link

ggscatterstats - requires 'scales_add_defaults()' function that is missing? #939

Closed jillymackay closed 4 months ago

jillymackay commented 4 months ago

Hey Indrajeet,

I love this package. I was prepping a learning resource for some students and noticed that ggscatterstats is giving me an error:

Error: ! Problem while computing aesthetics. ℹ Error occurred in the 3rd layer. Caused by error in scales_add_defaults(): ! could not find function "scales_add_defaults" Run rlang::last_trace() to see where the error occurred.

iris |> 
ggscatterstats(x = Petal.Width, y = Sepal.Width)

I get this even when tidyverse and easystats are loaded, so I'm not sure where scales_add_defaults() is supposed to be loading from (and google is not being helpful)

Backtrace: ▆

  1. ├─base (local) <fn>(x)
  2. ├─ggplot2:::print.ggplot(x)
  3. │ ├─ggplot2::ggplot_build(x)
  4. │ └─ggplot2:::ggplot_build.ggplot(x)
  5. │ └─ggplot2:::by_layer(...)
  6. │ ├─rlang::try_fetch(...)
  7. │ │ ├─base::tryCatch(...)
  8. │ │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
  9. │ │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
    1. │ │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
    2. │ │ └─base::withCallingHandlers(...)
    3. │ └─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
    4. │ └─l$compute_aesthetics(d, plot)
    5. │ └─ggplot2 (local) compute_aesthetics(..., self = self)
    6. └─base::.handleSimpleError(...)
    7. └─rlang (local) h(simpleError(msg, call))
    8. └─handlers[1L]
    9. └─cli::cli_abort(...)
    10. └─rlang::abort(...)
IndrajeetPatil commented 4 months ago

This is the same issue as https://github.com/jtlandis/ggside/issues/56

You just need to update ggside and ggstatsplot to their latest CRAN versions.

jillymackay commented 4 months ago

Fab! thanks!