CBIIT / R-cometsAnalytics

R package development for COMETS Analytics
12 stars 10 forks source link

subselect is no longer available on CRAN #106

Open park-brian opened 1 month ago

park-brian commented 1 month ago

It looks like subselect is no longer available as of 2024-07-31: https://cran.r-project.org/web/packages/subselect/index.html

It's being used here: runModel_checks.R

We may want to update the installation instructions so that people can install subselect from the archives (while we look for a suitable replacement)

We may also be able to extract the function from the R package and use it internally:

trim.matrix <- function(mat,tolval=10*.Machine$double.eps)
{
  p <- dim(mat)[2]
  matindices <- 1:p                  
  mat.eig <- eigen(mat,symmetric=TRUE)
  discard <- rep(FALSE,p)
  newmat <- mat
  newmatindices <- matindices        
  while(mat.eig$values[p]/mat.eig$values[1] < tolval)
  {
    int <- as.numeric(newmatindices[order(abs(mat.eig$vectors[,p]),decreasing=TRUE)[1]])   
    discard[int] <- TRUE
    newmat <- mat[!discard,!discard]
    newmatindices <- matindices[!discard]   
    p <- p-1
    mat.eig <- eigen(newmat,symmetric=TRUE)   
  }
  size <- dim(newmat)[2]
  output <- list(newmat,as.numeric(matindices[discard]),colnames(mat)[discard],size)   
  names(output) <- c("trimmedmat","numbers.discarded","names.discarded","size")
  output
}

For reference, here is the URL for the latest archived version of the subselect package (0.15.5): https://cran.r-project.org/src/contrib/Archive/subselect/subselect_0.15.5.tar.gz

# installation instructions for subselect 0.15.5
install.packages(
  "https://cran.r-project.org/src/contrib/Archive/subselect/subselect_0.15.5.tar.gz", 
  repos = NULL, 
  type = "source"
)