Skip to content

Commit

Permalink
try to fix rcmdcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
jiajic committed Oct 3, 2023
1 parent 80fb397 commit 9da5cbc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
^pkgdown$
.Rbuildignore.save
^\.github$
^codecov\.yml$
2 changes: 1 addition & 1 deletion .github/workflows/main_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ import(GiottoUtils)
import(GiottoVisuals)
import(ggplot2)
import(methods)
import(spdep)
import(stats)
import(utils)
importClassesFrom(data.table,data.table)
Expand Down
16 changes: 8 additions & 8 deletions R/spdep.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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()')
Expand Down

0 comments on commit 9da5cbc

Please sign in to comment.