Skip to content

Commit 776494d

Browse files
committed
use insight funs
1 parent e44f3da commit 776494d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

R/check_reliability.R

+5-7
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ check_reliability <- function(x, ...) {
2828
}
2929

3030

31-
32-
3331
#' @export
3432
check_reliability.default <- function(x, ...) {
3533
check_reliability(modelbased::estimate_grouplevel(x, ...), ...)
@@ -45,24 +43,24 @@ check_reliability.estimate_grouplevel <- function(x, ...) {
4543
if (length(unique(x$Level)) <= 3) {
4644
insight::format_alert(paste0(
4745
"The number of random levels (N = ",
48-
length(unique(x$Level)),
46+
insight::n_unique(x$Level),
4947
") might be too low to reliably estimate the variability."
5048
))
5149
}
5250

5351
if (length(dispname) == 0) {
5452
insight::format_error(paste0(
5553
"This function requires an index of variability of each random ",
56-
"effect (e.g., SE) but none was found. Try running check_reliability() on the",
57-
" output of modelbased::estimate_grouplevel(model), and make sure the latter ",
54+
"effect (e.g., SE) but none was found. Try running `check_reliability()` on the",
55+
" output of `modelbased::estimate_grouplevel(model)`, and make sure the latter ",
5856
"returns a table with an index of dispersion."
5957
))
6058
}
6159

6260
if (length(dispname) > 1) {
6361
insight::format_alert(paste0(
6462
"Multiple indices of variability were found (",
65-
paste(dispname, collapse = ", "),
63+
toString(dispname),
6664
"). Using the first one."
6765
))
6866
dispname <- dispname[1]
@@ -91,7 +89,7 @@ check_reliability.estimate_grouplevel <- function(x, ...) {
9189
}
9290

9391
# Clean-up output
94-
if (length(unique(reliability$Component)) == 1 && unique(reliability$Component) == "TEMP") {
92+
if (insight::n_unique(reliability$Component) == 1 && unique(reliability$Component) == "TEMP") {
9593
reliability$Component <- NULL
9694
}
9795

0 commit comments

Comments
 (0)