Pages: [1]
  Print  
Author Topic: Attribute types and assigning NA in R script  (Read 315 times)
tennenrishin
Full Member
***
Posts: 174


WWW
« on: July 19, 2013, 08:20:01 PM »

I'm not sure whether this is more of an R question or more of an RM question.

This process
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.008">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.3.008" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="generate_data_user_specification" compatibility="5.3.008" expanded="true" height="60" name="Generate Data by User Specification" width="90" x="179" y="165">
        <list key="attribute_values">
          <parameter key="T" value="date_parse_custom(&quot;2013.07.19 10:33:22&quot;,&quot;yyyy.MM.dd HH:mm:ss&quot;,&quot;en&quot;)"/>
        </list>
        <list key="set_additional_roles"/>
      </operator>
      <operator activated="true" class="date_to_nominal" compatibility="5.3.008" expanded="true" height="76" name="Date to Nominal" width="90" x="313" y="165">
        <parameter key="attribute_name" value="T"/>
        <parameter key="date_format" value="yyyy.MM.dd HH:mm:ss.SSS"/>
      </operator>
      <operator activated="true" class="r:execute_script_r" compatibility="5.3.000" expanded="true" height="76" name="Execute Script (R)" width="90" x="447" y="165">
        <parameter key="script" value="output &lt;- input&#10;output[,] &lt;- NA&#10;output[1,] &lt;- input[1,]&#10;# This is a minimal script to reproduce the problem.&#10;# In the actual script, the purpose of the first two lines are to allocate memory&#10;# and the data is transformed during the line-by-line assignment into the output.&#10;"/>
        <enumeration key="inputs">
          <parameter key="name_of_variable" value="input"/>
        </enumeration>
        <list key="results">
          <parameter key="output" value="Data Table"/>
        </list>
      </operator>
      <operator activated="true" class="nominal_to_date" compatibility="5.3.008" expanded="true" height="76" name="Nominal to Date" width="90" x="581" y="165">
        <parameter key="attribute_name" value="T"/>
        <parameter key="date_type" value="date_time"/>
        <parameter key="date_format" value="yyyy.MM.dd HH:mm:ss.SSS"/>
      </operator>
      <connect from_op="Generate Data by User Specification" from_port="output" to_op="Date to Nominal" to_port="example set input"/>
      <connect from_op="Date to Nominal" from_port="example set output" to_op="Execute Script (R)" to_port="input 1"/>
      <connect from_op="Execute Script (R)" from_port="output 1" to_op="Nominal to Date" to_port="example set input"/>
      <connect from_op="Nominal to Date" from_port="example set output" to_port="result 1"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
    </process>
  </operator>
</process>
works if line 2 of the R script is commented out, but not if it isn't. Why is that, and how can I blank that dataframe without breaking the process. The minimalistic example seems quite silly but the background is hard to explain briefly.
« Last Edit: July 19, 2013, 11:42:43 PM by tennenrishin » Logged
Marius
Administrator
Hero Member
*****
Posts: 1793



WWW
« Reply #1 on: July 22, 2013, 01:21:24 PM »

I am not an R expert, so I have to ask this question: does this script run in the R version that you have configured in RapidMiner? Is the expected output a simple copy of the input?

Best regards,
Marius
Logged

Please add [SOLVED] to the topic title when your problem has been solved! (do so by editing the first post in the thread and modifying the title)
Please click here before posting.
Pages: [1]
  Print  
 
Jump to: