summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorChris Sobczak <chris@sobczak.family>2026-06-10 20:54:26 -0700
committerChris Sobczak <chris@sobczak.family>2026-06-10 20:54:26 -0700
commit14cb619997719aac2971b5ef89feacc421764458 (patch)
tree89c90e84b40579d67c0ad72811f2b1719ff70f46 /R
parentcbed2931c9244daa2e1e8d4c0b13958f8e5e0148 (diff)
Update docs
Diffstat (limited to 'R')
-rw-r--r--R/rsc.R13
1 files changed, 8 insertions, 5 deletions
diff --git a/R/rsc.R b/R/rsc.R
index b46ae84..025ec0b 100644
--- a/R/rsc.R
+++ b/R/rsc.R
@@ -39,19 +39,22 @@ rsc <- function(cv, threshold = "minimum", weights = NULL){
}
}
+ # make a copy
+ rmadvec <- cv$rmadvec
+
## threshold the rmadvec
if(is.null(weights)){
- cv$rmadvec[ abs(cv$rmadvec) < threshold ] <- 0
+ rmadvec[ abs(rmadvec) < threshold ] <- 0
}else{
- T <- abs(cv$rmadvec) * weights
- cv$rmadvec[ T < threshold ] <- 0
+ T <- abs(rmadvec) * weights
+ rmadvec[ T < threshold ] <- 0
}
- nc <- length(cv$rmadvec)
+ nc <- length(rmadvec)
p <- {1 + sqrt( 1 + 8 * nc ) } / 2
R <- Matrix(1, nrow = p, ncol = p, sparse = TRUE)
- R[lower.tri(R , diag = FALSE)] <- cv$rmadvec
+ R[lower.tri(R , diag = FALSE)] <- rmadvec
R <- forceSymmetric(R , uplo="L")
## attach dimnames if needed