如何更改标签属性中因子级别的顺序?我想实现这个R命令:
(Label<- relevel(Label, ref = "Yes")
我该怎么做?
答案 0 :(得分:1)
您可以使用<?xml version="1.0" encoding="UTF-8"?><process version="7.2.003">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="7.2.003" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="7.2.003" expanded="true" height="68" name="Retrieve Iris" width="90" x="112" y="85">
<parameter key="repository_entry" value="//Samples/data/Iris"/>
</operator>
<operator activated="true" class="r_scripting:execute_r" compatibility="7.2.000" expanded="true" height="103" name="Execute R" width="90" x="246" y="85">
<parameter key="script" value="# rm_main is a mandatory function, # the number of arguments has to be the number of input ports (can be none) rm_main = function(data) { print('Hello, world!') # output can be found in Log View # your code goes here 	data$label = factor(data$label) 	data2 = data 	data2$label = relevel(data2$label, ref = 'Iris-virginica') 	print(str(data)) 	print(str(data2)) 	 return(list(data, data2)) } "/>
</operator>
<connect from_op="Retrieve Iris" from_port="output" to_op="Execute R" to_port="input 1"/>
<connect from_op="Execute R" from_port="output 1" to_port="result 1"/>
<connect from_op="Execute R" from_port="output 2" to_port="result 2"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
<portSpacing port="sink_result 3" spacing="0"/>
</process>
</operator>
</process>
运算符。这是一个更改虹膜数据集中标签级别的示例。如果查看RapidMiner日志,则可以看到显示结构的打印语句。
Set Role
我发现在R脚本之后删除了id和label角色,但可以使用{{1}}运算符修复此问题。