alts <- paste0("alt", 1:4)
crit <- paste0("x", 1:3)
performanceTable <- matrix(runif(length(alts)*length(crit)),
nrow=length(alts), ncol=length(crit),
dimnames=list(alts, crit))
weights <- setNames(c(1,2,3), crit)
# Overall
weightedSum(performanceTable, weights)
# Subset of alteratives and criteria
weightedSum(performanceTable, weights,
alternativesIDs=c("alt2","alt3"), criteriaIDs=c("x2","x3"))
Run the code above in your browser using DataLab