From 9da5cbc2cbb22efe720c7e28a925187bf8d1b33f Mon Sep 17 00:00:00 2001 From: jiajic <72078254+jiajic@users.noreply.github.com> Date: Tue, 3 Oct 2023 19:05:08 -0400 Subject: [PATCH] try to fix rcmdcheck --- .Rbuildignore | 1 + .github/workflows/main_check.yaml | 2 +- NAMESPACE | 1 - R/spdep.R | 16 ++++++++-------- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index b5d8c96f8..86f1b62e9 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -14,3 +14,4 @@ ^pkgdown$ .Rbuildignore.save ^\.github$ +^codecov\.yml$ diff --git a/.github/workflows/main_check.yaml b/.github/workflows/main_check.yaml index 1445d44d8..60e988f8d 100644 --- a/.github/workflows/main_check.yaml +++ b/.github/workflows/main_check.yaml @@ -58,7 +58,7 @@ jobs: _R_CHECK_RD_XREFS: false with: dependencies: '"hard"' # do not use suggested dependencies - extra-packages: any::rcmdcheck, any::testthat, any::rlang, any::R.utils, any::remotes, any::covr + extra-packages: any::rcmdcheck, any::testthat, any::rlang, any::R.utils, any::remotes, any::covr, any::spdep - name: Set up dependencies (GiottoData) run: | diff --git a/NAMESPACE b/NAMESPACE index b4f744ff4..0bd26fb31 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -402,7 +402,6 @@ import(GiottoUtils) import(GiottoVisuals) import(ggplot2) import(methods) -import(spdep) import(stats) import(utils) importClassesFrom(data.table,data.table) diff --git a/R/spdep.R b/R/spdep.R index ff4779957..43d1e8291 100644 --- a/R/spdep.R +++ b/R/spdep.R @@ -13,7 +13,7 @@ #' @export spdepAutoCorr <- function (gobject, - method = c("geary.test", "lee.test", "lm.morantest","moran.test"), + method = c("geary.test", "lee.test", "lm.morantest", "moran.test"), spat_unit = NULL, feat_type = NULL, expression_values = "normalized", @@ -61,32 +61,32 @@ spdepAutoCorr <- function (gobject, feat <- resultSpdepCor$feats weight_matrix <- resultSpdepCor$weight_matrix use_values <- resultSpdepCor$use_values - + #progressr nfeats = length(feat) step_size = ceiling(nfeats/10L) - + result_list <- list() progressr::with_progress({ if(step_size > 1) pb = progressr::progressor(steps = nfeats/step_size) result_list <- lapply_flex(seq_along(feat), function(feat_value){ callSpdepVar <- callSpdep(method = method, - x = use_values[,feat_value], + x = use_values[,feat_value], listw = mat2listw (weight_matrix, style = "W")) # Extract the estimated value from the result - result_value <- callSpdepVar$estimate[1] + result_value <- callSpdepVar$estimate[1] temp_dt <- data.table(feat_ID = feat[feat_value], value = result_value) # increment progress - if(exists('pb')) if(feat_value %% step_size == 0) pb() + if(exists('pb')) if(feat_value %% step_size == 0) pb() return(temp_dt) } ) }) result_dt <- rbindlist(result_list) - + # Return the resulting datatable - + if(isTRUE(return_gobject)) { if(isTRUE(verbose)) wrap_msg('Appending', method, 'results to feature metadata: fDataDT()')