Skip to content

Commit

Permalink
clean few line length lints
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed Mar 31, 2023
1 parent 9fb26df commit 189dccd
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 12 deletions.
24 changes: 21 additions & 3 deletions R/binned_residuals.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,29 @@ print.binned_residuals <- function(x, ...) {

if (!is.null(resid_ok)) {
if (resid_ok < 0.8) {
insight::print_color(sprintf("Warning: Probably bad model fit. Only about %g%% of the residuals are inside the error bounds.\n", round(100 * resid_ok)), "red")
insight::print_color(
sprintf(
"Warning: Probably bad model fit. Only about %g%% of the residuals are inside the error bounds.\n",
round(100 * resid_ok)
),
"red"
)
} else if (resid_ok < 0.95) {
insight::print_color(sprintf("Warning: About %g%% of the residuals are inside the error bounds (~95%% or higher would be good).\n", round(100 * resid_ok)), "yellow")
insight::print_color(
sprintf(
"Warning: About %g%% of the residuals are inside the error bounds (~95%% or higher would be good).\n",
round(100 * resid_ok)
),
"yellow"
)
} else {
insight::print_color(sprintf("Ok: About %g%% of the residuals are inside the error bounds.\n", round(100 * resid_ok)), "green")
insight::print_color(
sprintf(
"Ok: About %g%% of the residuals are inside the error bounds.\n",
round(100 * resid_ok)
),
"green"
)
}
}
}
Expand Down
16 changes: 14 additions & 2 deletions R/check_autocorrelation.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,21 @@ plot.check_autocorrelation <- function(x, ...) {
#' @export
print.check_autocorrelation <- function(x, ...) {
if (x < 0.05) {
insight::print_color(sprintf("Warning: Autocorrelated residuals detected (%s).", insight::format_p(x)), "red")
insight::print_color(
sprintf(
"Warning: Autocorrelated residuals detected (%s).",
insight::format_p(x)
),
"red"
)
} else {
insight::print_color(sprintf("OK: Residuals appear to be independent and not autocorrelated (%s).", insight::format_p(x)), "green")
insight::print_color(
sprintf(
"OK: Residuals appear to be independent and not autocorrelated (%s).",
insight::format_p(x)
),
"green"
)
}
invisible(x)
}
Expand Down
12 changes: 10 additions & 2 deletions R/check_factorstructure.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,18 @@ check_kmo <- function(x, n = NULL, ...) {

# TODO: add interpret_kmo in effectsize and use that here for more fine-grained interpretation
if (MSA < 0.5) {
text <- sprintf("The Kaiser, Meyer, Olkin (KMO) overall measure of sampling adequacy suggests that factor analysis is likely to be inappropriate (KMO = %.2f).", MSA)
text <-
sprintf(
"The Kaiser, Meyer, Olkin (KMO) overall measure of sampling adequacy suggests that factor analysis is likely to be inappropriate (KMO = %.2f).",
MSA
)
color <- "red"
} else {
text <- sprintf("The Kaiser, Meyer, Olkin (KMO) overall measure of sampling adequacy suggests that data seems appropriate for factor analysis (KMO = %.2f).", MSA)
text <-
sprintf(
"The Kaiser, Meyer, Olkin (KMO) overall measure of sampling adequacy suggests that data seems appropriate for factor analysis (KMO = %.2f).",
MSA
)
color <- "green"
}

Expand Down
7 changes: 6 additions & 1 deletion R/check_model_diagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@

if (is.null(res_)) {
if (verbose) {
insight::format_alert(sprintf("QQ plot could not be created. Cannot extract residuals from objects of class `%s`.", class(model)[1]))
insight::format_alert(
sprintf(
"QQ plot could not be created. Cannot extract residuals from objects of class `%s`.",
class(model)[1]
)
)
}
return(NULL)
}
Expand Down
3 changes: 2 additions & 1 deletion R/performance_roc.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#' @param ... One or more models with binomial outcome. In this case,
#' `new_data` is ignored.
#'
#' @note There is also a [`plot()`-method](https://easystats.github.io/see/articles/performance.html) implemented in the \href{https://easystats.github.io/see/}{\pkg{see}-package}.
#' @note There is also a [`plot()`-method](https://easystats.github.io/see/articles/performance.html)
#' implemented in the \href{https://easystats.github.io/see/}{\pkg{see}-package}.
#'
#' @return A data frame with three columns, the x/y-coordinate pairs for the ROC
#' curve (`Sensitivity` and `Specificity`), and a column with the
Expand Down
11 changes: 9 additions & 2 deletions R/performance_score.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,21 @@ performance_score <- function(model, verbose = TRUE, ...) {
}

if (minfo$is_ordinal || minfo$is_multinomial) {
if (verbose) insight::print_color("Can't calculate proper scoring rules for ordinal, multinomial or cumulative link models.\n", "red")
if (verbose) {
insight::print_color("Can't calculate proper scoring rules for ordinal, multinomial or cumulative link models.\n", "red")
}
return(list(logarithmic = NA, quadratic = NA, spherical = NA))
}

resp <- insight::get_response(model, verbose = verbose)

if (!is.null(ncol(resp)) && ncol(resp) > 1) {
if (verbose) insight::print_color("Can't calculate proper scoring rules for models without integer response values.\n", "red")
if (verbose) {
insight::print_color(
"Can't calculate proper scoring rules for models without integer response values.\n",
"red"
)
}
return(list(logarithmic = NA, quadratic = NA, spherical = NA))
}

Expand Down
3 changes: 2 additions & 1 deletion man/performance_roc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 189dccd

Please sign in to comment.