R/weightsGivenSize.R

`weightsGivenSize` <-
function(vec, modlist){
  modsizes <- sapply(modlist, num.Terms)
  ttab <- table(modsizes)
  if(length(vec)!=length(names(ttab)))stop("vec is wrong length")
  sizes <- as.numeric(names(ttab))
  wts <- rep(0, length(modlist))
  count = 0
  for(j in unique(sizes)){
    count = count+1
    for(k in 1:length(modlist)){
      if(modsizes[k]==j){
        wts[k] <- vec[count]/as.numeric(ttab[count])}}}
  wts
}

Try the CombMSC package in your browser

Any scripts or data that you put into this service are public.

CombMSC documentation built on May 2, 2019, 2:32 p.m.