diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 75f1bcf..d9b8d91 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,6 +26,6 @@ jobs: needs: lint - name: Lint - run: tmp <- lintr::lint_package(); if (length(tmp) > 0) {print(tmp); stop("linter found problems")} + run: lintr::lint_package() shell: Rscript {0} diff --git a/R/helper.R b/R/helper.R index bd09b8b..d5aeab1 100644 --- a/R/helper.R +++ b/R/helper.R @@ -19,9 +19,9 @@ BayesMCPMod <- function( sign <- 0 for (j in 1:m) { - conttheta <- sapply(1:nrow(ancova[["est."]]), function(x) t(contMat[, j]) %*% ancova[["est."]][x, ]) - contvar <- sapply(1:nrow(ancova[["est."]]), function(x) t(contMat[, j]^2) %*% ancova[["cov."]][x, ]^2) - p_ij <- sapply(1:nrow(ancova[["est."]]), function(x) stats::pnorm(conttheta[x] / sqrt(contvar[x]))) + conttheta <- sapply(seq_len(nrow(ancova[["est."]])), function(x) t(contMat[, j]) %*% ancova[["est."]][x, ]) + contvar <- sapply(seq_len(nrow(ancova[["est."]])), function(x) t(contMat[, j]^2) %*% ancova[["cov."]][x, ]^2) + p_ij <- sapply(seq_len(nrow(ancova[["est."]])), function(x) stats::pnorm(conttheta[x] / sqrt(contvar[x]))) probs[j] <- sum(ancova[["obs."]] * p_ij) diff --git a/R/modelling.R b/R/modelling.R index 273eced..e6abc27 100644 --- a/R/modelling.R +++ b/R/modelling.R @@ -230,7 +230,7 @@ getGenAICs <- function( exp_values <- exp(-0.5 * avgAIC_values) denominator <- sum(exp_values) - for (i in 1:length(results)) { + for (i in seq_along(results)) { results[[i]]$weightedAIC <- exp_values[i] / denominator }