strengejacke / sjPlot

sjPlot - Data Visualization for Statistics in Social Science
https://strengejacke.github.io/sjPlot
606 stars 91 forks source link

plot_model error: Error in pretty.default(c(floor(lower_lim), ceiling(upper_lim)))... #846

Closed wthogmartin closed 2 years ago

wthogmartin commented 2 years ago

I believe the issue is similar to https://github.com/strengejacke/sjPlot/issues/845 thought the error message differs

The error message in question: Error in pretty.default(c(floor(lower_lim), ceiling(upper_lim))) : 7 arguments passed to .Internal(pretty) which requires 8

A reproducible example:

dt<-data.frame(y=rnorm(100),x=rnorm(100),z=rnorm(100), A=sample(c('group 1', 'group 2', 'group 3'), 100, replace=TRUE))
m0 <- lm(y ~ A*x + A*z, data=dt)
sjPlot::plot_model(m0)
sjPlot::plot_model(m0, type = "eff")
sjPlot::plot_model(m0, type = "pred")

m1 <- lm(y ~ x + z, data=dt)
sjPlot::plot_model(m1)

m2 <- lm(y~x, data=dt)
sjPlot::plot_model(m2)

all return the same error.

I've tried various 8 argument plots, but identifying which argument is missing has been unsuccessful so far

strengejacke commented 2 years ago

Cannot reproduce, works fine for me:

dt <-
  data.frame(
    y = rnorm(100),
    x = rnorm(100),
    z = rnorm(100),
    A = sample(c('group 1', 'group 2', 'group 3'), 100, replace = TRUE)
  )
m0 <- lm(y ~ A * x + A * z, data = dt)
sjPlot::plot_model(m0)

sjPlot::plot_model(m0, type = "eff")
#> $A

#> 
#> $x

#> 
#> $z

sjPlot::plot_model(m0, type = "pred")
#> $A

#> 
#> $x

#> 
#> $z

m1 <- lm(y ~ x + z, data = dt)
sjPlot::plot_model(m1)

m2 <- lm(y ~ x, data = dt)
sjPlot::plot_model(m2)

Created on 2022-07-31 by the reprex package (v2.0.1)

wthogmartin commented 2 years ago

I should have indicated this earlier but I am working with R 4.2 and sjPlot 2.8.10.

wthogmartin commented 2 years ago

The problem was resolved updating from R 4.2 to R 4.2.1