getAlternativesComparisonsLabels(RXMCDA)
getAlternativesComparisonsLabels()所属R语言包:RXMCDA
Get comparisons of alternatives
替代品比较
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Extracts <alternativesComparisons> from an XML tree written according to the XMCDA standard and stores the IDs of the concerned alternatives.
提取物<alternativesComparisons>根据XMCDA标准,和存储的ID有关的替代方法编写的XML树。
用法----------Usage----------
getAlternativesComparisonsLabels(tree, altIDs=NULL, mcdaConcept = NULL)
参数----------Arguments----------
参数:tree
Object containing the XMCDA XML tree.
Object,包含XMCDAXML树。
参数:altIDs
A vector containing the IDs of the alternatives to be considered for the extractions.
提取被认为是一个向量,包含的ID的替代品。
参数:mcdaConcept
A string containing the specific mcdaConcept attribute which should be searched for.
一个字符串,其中包含的具体mcdaConcept属性应搜索。
值----------Value----------
The function returns a list structured as follows:
该函数返回一个列表结构如下:
参数:–
The first elements contain the <alternativesComparisons> found in <tree> as matrices. These elements are named according to the mcdaConcept attribute if it can be found. Each line of each matrix corresponds to one constraint of the type "alternative a is preferred to alternative b with preference threshold delta". A line is structured as follows: the first element encodes the ID of alternative a, the second element encodes the ID of alternative b, and the last element contains the preference threshold delta.
第一个元素包含了<alternativesComparisons> <tree>为矩阵。这些元素的命名是根据mcdaConcept属性,如果可以找到。每个矩阵的每一行对应于一个约束类型“可选择的最好备选方案B的偏好阈值Delta”。 A线的结构如下:第一个元素编码ID的替代,所述第二元件备选方案B中的ID编码,而最后一个元素中包含的优先级阈值增量。
参数:status
Either OK if all the <alternativesComparisons> tags could be correctly read, or the description of the error.
无论是OK的,如果所有的<alternativesComparisons>标签可以正确读出,或对错误的描述。
实例----------Examples----------
tree = newXMLDoc()
newXMLNode("xmcda:XMCDA", namespace = c("xsi" = "http://www.w3.org/2001/XMLSchema-instance", "xmcda" = "http://www.decision-deck.org/2009/XMCDA-2.1.0"), parent=tree)
root<-getNodeSet(tree, "/xmcda:XMCDA")
aC<-newXMLNode("alternativesComparisons", parent=root[[1]], namespace=c())
pairs<-newXMLNode("pairs", parent=aC, namespace=c())
pair<-newXMLNode("pair", parent=pairs, namespace=c())
initial<-newXMLNode("initial", parent=pair, namespace=c())
newXMLNode("alternativeID", "a01", parent=initial, namespace=c())
terminal<-newXMLNode("terminal", parent=pair, namespace=c())
newXMLNode("alternativeID", "a02", parent=terminal, namespace=c())
value<-newXMLNode("value", parent=pair, namespace=c())
newXMLNode("real", "0.5", parent=value, namespace=c())
alternativesIDs <- c("a01","a02")
y<-getNodeSet(tree,"//alternativesComparisons")
x<-getAlternativesComparisonsLabels(y[[1]], alternativesIDs)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|