| weightedSum | R Documentation | 
Computes the weighted sum of the evaluations of alternatives, stored in a performance table, with respect to a vector of criteria weights.
weightedSum(
  performanceTable,
  criteriaWeights,
  alternativesIDs = NULL,
  criteriaIDs = NULL
)
| performanceTable | Matrix or data frame containing the performance table. Each row corresponds to an alternative, and each column to a criterion. Rows (resp. columns) must be named according to the IDs of the alternatives (resp. criteria). | 
| criteriaWeights | Vector containing the weights of the criteria. The elements are named according to the IDs of the criteria. | 
| alternativesIDs | Vector containing IDs of alternatives, according to which the performance table should be filtered. | 
| criteriaIDs | Vector containing IDs of criteria, according to which the performance table should be filtered. | 
The function returns a vector containing the weighted sum of the alternatives with respect to the criteria weights.
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.