diff options
Diffstat (limited to 'R')
| -rw-r--r-- | R/rsc.R | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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 |
