Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename at arguments into by #255

Merged
merged 24 commits into from
May 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
strengejacke committed May 23, 2024
commit 9cfd7b58d69bef1e5966ef2981f87f1a3f461492
2 changes: 1 addition & 1 deletion R/visualisation_recipe.estimate_means.R
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
#' layers <- visualisation_recipe(x)
#' layers
#' plot(layers)
#' \donttest{
#' \dontrun{
#' # Customize aesthetics
#' layers <- visualisation_recipe(x,
#' jitter = list(width = 0.03, color = "red"),
@@ -77,7 +77,7 @@
l <- 1

# Show data (points, boxplot, violin, etc.)
if (!is.null(show_data) && all(show_data != "none") && all(show_data != FALSE)) {

Check warning on line 80 in R/visualisation_recipe.estimate_means.R

GitHub Actions / lint-changed-files / lint-changed-files

file=R/visualisation_recipe.estimate_means.R,line=80,col=62,[redundant_equals_linter] Using != on a logical vector is redundant. Well-named logical vectors can be used directly in filtering. For data.table's `i` argument, wrap the column name in (), like `DT[(is_treatment)]`.
# Default changes for binomial models
shape <- 16
stroke <- 0
2 changes: 1 addition & 1 deletion R/visualisation_recipe.estimate_predicted.R
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
#' layers
#' plot(layers)
#'
#' \donttest{
#' \dontun{
#' # Customize aesthetics ----------
#'
#' layers <- visualisation_recipe(x,
@@ -118,7 +118,7 @@
#' }
#' }
#' @export
visualisation_recipe.estimate_predicted <- function(x,

Check warning on line 121 in R/visualisation_recipe.estimate_predicted.R

GitHub Actions / lint-changed-files / lint-changed-files

file=R/visualisation_recipe.estimate_predicted.R,line=121,col=1,[cyclocomp_linter] Reduce the cyclomatic complexity of this function from 42 to at most 40.
show_data = "points",
point = NULL,
density_2d = NULL,
@@ -128,7 +128,7 @@
...) {
info <- attributes(x)
layers <- list()
data <- as.data.frame(x)

Check warning on line 131 in R/visualisation_recipe.estimate_predicted.R

GitHub Actions / lint-changed-files / lint-changed-files

file=R/visualisation_recipe.estimate_predicted.R,line=131,col=3,[object_overwrite_linter] 'data' is an exported object from package 'utils'. Avoid re-using such symbols.
y <- info$response
alpha <- NULL
color <- NULL
@@ -136,7 +136,7 @@
size <- NULL
x2 <- NULL
x3 <- NULL
jitter <- FALSE

Check warning on line 139 in R/visualisation_recipe.estimate_predicted.R

GitHub Actions / lint-changed-files / lint-changed-files

file=R/visualisation_recipe.estimate_predicted.R,line=139,col=3,[object_overwrite_linter] 'jitter' is an exported object from package 'base'. Avoid re-using such symbols.
skip_line <- FALSE
group <- 1

@@ -169,7 +169,7 @@
group <- ".group"
# If x-axis is a factor, then we cannot add the line + we need to jitter the pointrnage
if (!is.numeric(data[[x1]])) {
jitter <- TRUE

Check warning on line 172 in R/visualisation_recipe.estimate_predicted.R

GitHub Actions / lint-changed-files / lint-changed-files

file=R/visualisation_recipe.estimate_predicted.R,line=172,col=7,[object_overwrite_linter] 'jitter' is an exported object from package 'base'. Avoid re-using such symbols.
skip_line <- TRUE
}
}
@@ -194,7 +194,7 @@
# 4+ interaction
if (length(targets) > 0L) {
# TODO: We could add the fourth term as facets
insight::format_warning("It seems like more than 4 focal terms are present. Not sure how to plot it, so keeping only the 3 first variables (however, this might not be a good visualisation of your model).")

Check warning on line 197 in R/visualisation_recipe.estimate_predicted.R

GitHub Actions / lint-changed-files / lint-changed-files

file=R/visualisation_recipe.estimate_predicted.R,line=197,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 209 characters.
}


@@ -222,7 +222,7 @@
stroke <- 1

# Change scale to 1-2 in case outcome is factor (see #120)
if (!all(unique(rawdata[[y]]) %in% c(0, 1))) {

Check warning on line 225 in R/visualisation_recipe.estimate_predicted.R

GitHub Actions / lint-changed-files / lint-changed-files

file=R/visualisation_recipe.estimate_predicted.R,line=225,col=11,[if_not_else_linter] Prefer `if (A) x else y` to the less-readable `if (!A) y else x` in a simple if/else statement.
data[c("Predicted", "CI_low", "CI_high")] <- data[c("Predicted", "CI_low", "CI_high")] + 1
} else {
# Else force to numeric and not factor
4 changes: 2 additions & 2 deletions man/visualisation_recipe.estimate_predicted.Rd

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


Unchanged files with check annotations Beta

ends <- nrow(data)
# Iterate through all rows to find blocks
for (i in 2:nrow(data)) {
if ((data$Confidence[i] != sig) || ((centrality_signs[i] != centrality_sign) && data$Confidence[i] == "Uncertain")) {

Check warning on line 212 in R/estimate_slopes.R

GitHub Actions / lint-changed-files / lint-changed-files

file=R/estimate_slopes.R,line=212,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 121 characters.

Check warning on line 212 in R/estimate_slopes.R

GitHub Actions / lint / lint

file=R/estimate_slopes.R,line=212,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 121 characters.
centrality_sign <- centrality_signs[i]
sig <- data$Confidence[i]
starts <- c(starts, i)
insight::format_alert('No numeric variable was specified for slope estimation. Selecting `trend = "', trend, '"`.')
}
if (length(trend) > 1) {
insight::format_alert("More than one numeric variable was selected for slope estimation. Keeping only ", trend[1], ".")

Check warning on line 87 in R/get_emtrends.R

GitHub Actions / lint-changed-files / lint-changed-files

file=R/get_emtrends.R,line=87,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 123 characters.

Check warning on line 87 in R/get_emtrends.R

GitHub Actions / lint / lint

file=R/get_emtrends.R,line=87,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 123 characters.
trend <- trend[1]
}
facet_wrap = NULL,
labs = NULL,
...) {
data <- as.data.frame(x)

Check warning on line 35 in R/visualisation_recipe.estimate_grouplevel.R

GitHub Actions / lint-changed-files / lint-changed-files

file=R/visualisation_recipe.estimate_grouplevel.R,line=35,col=3,[object_overwrite_linter] 'data' is an exported object from package 'utils'. Avoid re-using such symbols.
# Fix order so that it's plotted with sorted levels
data$Level <- factor(data$Level, levels = sort(.to_numeric(unique(data$Level))))
# TODO: If estimate_response() is removed, document `NULL` with this text.
insight::format_alert(
"`estimate_response()` is deprecated.",
"Please use `estimate_expectation()` (for conditional expected values) or `estimate_prediction()` (for individual case predictions) instead."

Check warning on line 210 in R/estimate_predicted.R

GitHub Actions / lint / lint

file=R/estimate_predicted.R,line=210,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 145 characters.
)
estimate_expectation(...)
}
# Get original dataframe of random
data <- attributes(x)$data

Check warning on line 27 in R/reshape_grouplevel.R

GitHub Actions / lint / lint

file=R/reshape_grouplevel.R,line=27,col=3,[object_overwrite_linter] 'data' is an exported object from package 'utils'. Avoid re-using such symbols.
# Random parameters
if (all(group == "all")) group <- unique(x$Group)
)
# If nested, separate groups
if (grepl(":", g)) {

Check warning on line 60 in R/reshape_grouplevel.R

GitHub Actions / lint / lint

file=R/reshape_grouplevel.R,line=60,col=15,[fixed_regex_linter] Use ":" with fixed = TRUE here. This regular expression is static, i.e., its matches can be expressed as a fixed substring expression, which is faster to compute.
groups <- as.data.frame(t(sapply(strsplit(data_wide[[g]], ":"), function(x) as.data.frame(t(x)))))

Check warning on line 61 in R/reshape_grouplevel.R

GitHub Actions / lint / lint

file=R/reshape_grouplevel.R,line=61,col=65,[fixed_regex_linter] Use ":" with fixed = TRUE here. This regular expression is static, i.e., its matches can be expressed as a fixed substring expression, which is faster to compute.
names(groups) <- unlist(strsplit(g, ":"))

Check warning on line 62 in R/reshape_grouplevel.R

GitHub Actions / lint / lint

file=R/reshape_grouplevel.R,line=62,col=43,[fixed_regex_linter] Use ":" with fixed = TRUE here. This regular expression is static, i.e., its matches can be expressed as a fixed substring expression, which is faster to compute.
data_wide <- cbind(groups, data_wide)
data_wide[g] <- NULL
g <- names(groups)
# Merge while preserving order of original random
data[["__sort_id"]] <- seq_len(nrow(data))
data <- merge(data, data_wide, by = g, sort = FALSE)

Check warning on line 70 in R/reshape_grouplevel.R

GitHub Actions / lint / lint

file=R/reshape_grouplevel.R,line=70,col=5,[object_overwrite_linter] 'data' is an exported object from package 'utils'. Avoid re-using such symbols.
data <- data[order(data[["__sort_id"]]), ]

Check warning on line 71 in R/reshape_grouplevel.R

GitHub Actions / lint / lint

file=R/reshape_grouplevel.R,line=71,col=5,[object_overwrite_linter] 'data' is an exported object from package 'utils'. Avoid re-using such symbols.
data[["__sort_id"]] <- NULL
}
x$temp <- apply(x[names(combinations)], 1, paste, collapse = "_")
for (i in seq_len(nrow(combinations))) {
current_row <- paste0(t(combinations[i, ]), collapse = "_")

Check warning on line 86 in R/smoothing.R

GitHub Actions / lint / lint

file=R/smoothing.R,line=86,col=22,[paste_linter] Use paste(), not paste0(), to collapse a character vector when sep= is not used.
x[x$temp == current_row, nums] <- sapply(x[x$temp == current_row, nums], smoothing, method = method, strength = strength, ...)
}