Skip to content

Commit

Permalink
avoid loaded term
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed Oct 6, 2023
1 parent 3d07438 commit e87e9e0
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion R/check_if_installed.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ check_if_installed <- function(package,
minimum_version <- .safe(.get_dep_version(dep = package))
}

# sanity check for equal length of package and minimum_version
# validation check for equal length of package and minimum_version
if (!is.null(minimum_version) && length(package) != length(minimum_version)) {
minimum_version <- NULL
}
Expand Down
2 changes: 1 addition & 1 deletion R/compute_variances.R
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@
# anything missing? (i.e. correlated slope-intercept slopes)
missig_rnd_slope <- setdiff(names(out), names(rndslopes))
if (length(missig_rnd_slope)) {
# sanity check
# validation check
to_remove <- NULL
for (j in seq_along(out)) {
# identical random slopes might have different names, so
Expand Down
2 changes: 1 addition & 1 deletion R/ellipsis_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ ellipsis_info.default <- function(..., only_models = TRUE, verbose = TRUE) {
}
# unlist model objects, so "objects" contains the list of models
objects <- objects[[1]]
# sanity check
# validation check
if (is.null(object_names)) {
object_names <- paste("Model", seq_along(objects), sep = " ")
}
Expand Down
4 changes: 2 additions & 2 deletions R/export_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export_table <- function(x,
format <- "markdown"
}

# sanity check
# validation check
if (is.null(x) || (is.data.frame(x) && nrow(x) == 0) || is_empty_object(x)) {
if (isTRUE(verbose)) {
format_alert("Can't export table to ", format, ", data frame is empty.")
Expand Down Expand Up @@ -956,7 +956,7 @@ print.insight_table <- function(x, ...) {
}


# sanity check - clean caption, subtitle and footer from ansi-colour codes,
# validation check - clean caption, subtitle and footer from ansi-colour codes,
# which only work for text format... But if user occidentally provides colours
# for HTML format as well, remove those colour codes, so they don't appear as
# text in the table header and footer. Furthermore, in footers, we need to
Expand Down
2 changes: 1 addition & 1 deletion R/find_transformation.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' find_transformation(model)
#' @export
find_transformation <- function(x) {
# sanity check
# validation check
if (is.null(x) || is.data.frame(x) || !is_model(x)) {
return(NULL)
}
Expand Down
2 changes: 1 addition & 1 deletion R/format_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ format_table <- function(x,
use_symbols = getOption("insight_use_symbols", FALSE),
verbose = TRUE,
...) {
# sanity check
# validation check
if (is.null(x) || (is.data.frame(x) && nrow(x) == 0)) {
if (isTRUE(verbose)) {
format_alert("Can't format table, data frame is empty.")
Expand Down
2 changes: 1 addition & 1 deletion R/get_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ get_data <- function(x, ...) {
))
}

# sanity check- if data frame is named like a function, e.g.
# validation check- if data frame is named like a function, e.g.
# rep <- data.frame(...), we now have a function instead of the data
# we then need to reset "dat" to NULL and search in the global env

Expand Down
4 changes: 2 additions & 2 deletions R/get_datagrid.R
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ get_datagrid.numeric <- function(x, length = 10, range = "range", ...) {
return(sort(unique(x)))
}

# Sanity check
# validation check
if (!is.numeric(length)) {
format_error("`length` argument should be an number.")
}
Expand Down Expand Up @@ -741,7 +741,7 @@ get_datagrid.default <- function(x,
data = NULL,
verbose = TRUE,
...) {
# sanity check
# validation check
if (!is_model(x)) {
format_error("`x` must be a statistical model.")
}
Expand Down
4 changes: 2 additions & 2 deletions R/get_modelmatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ get_modelmatrix.iv_robust <- function(x, ...) {
dots <- list(...)
model_terms <- stats::terms(x)
if ("data" %in% names(dots)) {
# sanity check - model matrix needs response vector!
# validation check - model matrix needs response vector!
resp <- find_response(x)
d <- dots$data
dots$data <- NULL
Expand All @@ -76,7 +76,7 @@ get_modelmatrix.iv_robust <- function(x, ...) {
get_modelmatrix.lm_robust <- function(x, ...) {
dots <- list(...)
if ("data" %in% names(dots)) {
# sanity check - model matrix needs response vector!
# validation check - model matrix needs response vector!
resp <- find_response(x)
d <- dots$data
dots$data <- NULL
Expand Down
6 changes: 3 additions & 3 deletions R/get_predicted_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ get_predicted_ci.default <- function(x,
vcov_args = NULL,
verbose = TRUE,
...) {
# sanity check, if CI should be skipped
# validation check, if CI should be skipped
if (is.null(ci)) {
return(ci)
}
Expand Down Expand Up @@ -259,7 +259,7 @@ get_predicted_ci.bracl <- get_predicted_ci.mlm

dots <- list(...)

# Sanity checks
# validation checks
if (!is.null(se)) {
se <- as.numeric(se)
}
Expand Down Expand Up @@ -342,7 +342,7 @@ get_predicted_ci.bracl <- get_predicted_ci.mlm
ci = 0.95,
link_inv = NULL,
...) {
# Sanity checks
# validation checks
if (is.null(predictions)) {
return(data.frame(SE = se))
}
Expand Down
2 changes: 1 addition & 1 deletion R/get_predicted_gam.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ get_predicted.gam <- function(x,
choices = c("expectation", "expected", "link", "prediction", "predicted", "classification")
)

# Sanity checks
# validation checks
if (predict %in% c("prediction", "predicted")) {
if (verbose) {
format_warning(
Expand Down
4 changes: 2 additions & 2 deletions R/get_predicted_mixed.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ get_predicted.glmmTMB <- function(x,
iterations = NULL,
verbose = TRUE,
...) {
# Sanity checks
# validation checks
if (!is.null(predict) && predict %in% c("prediction", "predicted", "classification")) {
predict <- "expectation"
if (verbose) {
Expand Down Expand Up @@ -205,7 +205,7 @@ get_predicted.MixMod <- function(x,
iterations = NULL,
verbose = TRUE,
...) {
# Sanity checks
# validation checks
if (!is.null(predict) && predict %in% c("prediction", "predicted", "classification")) {
predict <- "expectation"
if (verbose) {
Expand Down
2 changes: 1 addition & 1 deletion R/get_weights.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ get_weights.default <- function(x, na_rm = FALSE, null_as_ones = FALSE, ...) {
)
}

# sanity check - if weights is empty, set to NULL
# validation check - if weights is empty, set to NULL
if (!length(w)) {
w <- NULL
}
Expand Down
4 changes: 2 additions & 2 deletions R/n_grouplevels.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ n_grouplevels <- function(x, ...) {
re_data <- .safe(get_data(x, verbose = FALSE))
}

# sanity check - did we successfully retrieve data and random effects?
# validation check - did we successfully retrieve data and random effects?
if (is.null(re_data) || is.null(ran_eff)) {
return(NULL)
}
Expand All @@ -66,7 +66,7 @@ n_grouplevels <- function(x, ...) {
)
)

# sanity check
# validation check
if (is.null(out)) {
return(NULL)
}
Expand Down
2 changes: 1 addition & 1 deletion R/utils_get_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@
}
pattern <- sprintf("%s\\(([^,\\+)]*).*", type)
out <- trim_ws(gsub(pattern, "\\1", grep(pattern, x, value = TRUE)))
# sanity check - when we have something like "log(1+x)" instead "log(x+1)",
# validation check - when we have something like "log(1+x)" instead "log(x+1)",
# the regex pattern returns "1" instead of "x3"
if (!is.na(suppressWarnings(as.numeric(out)))) {
out <- trim_ws(gsub(pattern, "\\2", grep(pattern, x, value = TRUE)))
Expand Down

0 comments on commit e87e9e0

Please sign in to comment.