insight icon indicating copy to clipboard operation
insight copied to clipboard

get_variance() returns NULL when R package site is built via github actions

Open matschmitz opened this issue 1 year ago • 1 comments

When building the site of a simple testing R package locally and rendering the article, the insight::get_variance() function works as expected. However, when building the site via GitHub Actions, the function returns NULL.

Steps to Reproduce:

Locally, render the following code in an article and observe that get_variance() works correctly:

library(pkgtest)
library(brms)
library(insight)

mdl <- brms::brm(mpg ~ hp + (1 | cyl), data = mtcars, cores = 4)

insight::get_variance(mdl)
#> $var.fixed 
#> [1] 4.873527 

#> $var.random
#> [1] 22.39223 

#> $var.residual 
#> [1] 8.502559 
#> attr(,"class") 
#> [1] "insight_aux" "numeric"

#> $var.distribution 
#> [1] 8.502559 
#> attr(,"class") #> [1] "insight_aux" "numeric"

#> $var.dispersion 
#> [1] 0 
#> $var.intercept 
#> cyl
#> 22.39223 

When the same article is rendered via GitHub Actions, the result of get_variance() is NULL

Local Build:

  • OS: Windows 10 x64
  • R version: 4.4.1 (2024-06-14 ucrt)
  • insight: 0.20.4 (CRAN)
  • brms: 2.21.0

GitHub Actions:

  • OS: Ubuntu 22.04.4 LTS
  • R version: 4.4.1
  • insight: 0.20.4 (CRAN)
  • brms: 2.21.0

There may be an environment or package dependency issue specific to GitHub Actions.

matschmitz avatar Sep 09 '24 08:09 matschmitz

As a workaround, does it help if you provide the null-model (using the null_model argument)?

strengejacke avatar Sep 18 '24 10:09 strengejacke