Learn R Programming

RXMCDA (version 1.5.5)

getAlternativesAffectations: Get alternative affectations

Description

Gets alternative affectations, stored in the tag, from an XML tree written according to the XMCDA standard.

Usage

getAlternativesAffectations(tree, alternativesIDs, categoriesIDs, mcdaConcept = NULL)

Arguments

tree
Object containing the XMCDA XML tree.
alternativesIDs
A vector containing the IDs of the alternatives to be considered for the extractions.
categoriesIDs
A vector containing the IDs of the categories to be considered for the extractions.
mcdaConcept
A string containing the specific mcdaConcept attribute which should be searched for.

Value

The function returns a list structured as follows:
--
The first elements contain n x m matrices representing each an , where n is number of considered alternatives and m is number of considered categories. Each cell [i, j] of each matrix is boolean and corresponds to encoded relation between i-th alternative and j-th category. Elements of returned list are named according to the mcdaConcept attribute if it can be found.
status
Either OK if all the tags could be correctly read, or the description of the error.

Examples

Run this code
tree <- xmlTreeParse(system.file("extdata",
                                 "testFile.xml",
                                 package="RXMCDA"), 
                                 useInternalNodes=TRUE)

alternativesIDs <- getAlternativesIDs(tree)
categoriesIDs <- getCategoriesIDs(tree)
altAff <- getAlternativesAffectations(tree, 
                                      alternativesIDs[[1]], categoriesIDs[[1]])

Run the code above in your browser using DataLab