image

🎉 🎉 RAPIDMINER 9.10 IS OUT!!! 🎉🎉

Download the latest version helping analytics teams accelerate time-to-value for streaming and IIOT use cases.

CLICK HERE TO DOWNLOAD

Turn a dataset of N rows and M columns into a single cell?

wesselwessel Member Posts: 537  Guru
edited November 2018 in Help
Dear All,

How do I turn a 5 by 2 data set into a single string?
The data set looks like this:

A B C D E
P Q R S T

the final result should be
"A B C D E P Q R S T"


Answers

  • wesselwessel Member Posts: 537  Guru
    This is the best I can come up with:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.003">
     <context>
       <input/>
       <output/>
       <macros/>
     </context>
     <operator activated="true" class="process" compatibility="5.2.003" expanded="true" name="Process">
       <process expanded="true" height="484" width="748">
         <operator activated="true" class="generate_data" compatibility="5.2.003" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30">
           <parameter key="number_examples" value="2"/>
         </operator>
         <operator activated="true" class="select_attributes" compatibility="5.2.003" expanded="true" height="76" name="Generate Data (2)" width="90" x="180" y="30">
           <parameter key="attribute_filter_type" value="single"/>
           <parameter key="attribute" value="label"/>
           <parameter key="invert_selection" value="true"/>
           <parameter key="include_special_attributes" value="true"/>
         </operator>
         <operator activated="true" class="loop_attributes" compatibility="5.2.003" expanded="true" height="60" name="Generate Data (3)" width="90" x="313" y="30">
           <parameter key="iteration_macro" value="att1"/>
           <process expanded="true" height="484" width="930">
             <operator activated="true" class="generate_attributes" compatibility="5.2.003" expanded="true" height="76" name="Generate Attributes" width="90" x="112" y="30">
               <list key="function_descriptions">
                 <parameter key="%{att1}" value="char(&quot;ABCDEFGHIJKLMNOP&quot;, round(abs(%{att1})))"/>
               </list>
             </operator>
             <connect from_port="example set" to_op="Generate Attributes" to_port="example set input"/>
             <connect from_op="Generate Attributes" from_port="example set output" to_port="example set"/>
             <portSpacing port="source_example set" spacing="0"/>
             <portSpacing port="sink_example set" spacing="0"/>
           </process>
         </operator>
         <operator activated="true" class="loop_attributes" compatibility="5.2.003" expanded="true" height="60" name="Merge" width="90" x="447" y="30">
           <parameter key="attribute_filter_type" value="single"/>
           <parameter key="attribute" value="att5"/>
           <parameter key="invert_selection" value="true"/>
           <parameter key="iteration_macro" value="att1"/>
           <process expanded="true" height="484" width="930">
             <operator activated="true" class="generate_attributes" compatibility="5.2.003" expanded="true" height="76" name="Generate Attributes (2)" width="90" x="447" y="30">
               <list key="function_descriptions">
                 <parameter key="att5" value="concat(att5, %{att1})"/>
               </list>
               <parameter key="use_standard_constants" value="false"/>
             </operator>
             <connect from_port="example set" to_op="Generate Attributes (2)" to_port="example set input"/>
             <connect from_op="Generate Attributes (2)" from_port="example set output" to_port="example set"/>
             <portSpacing port="source_example set" spacing="0"/>
             <portSpacing port="sink_example set" spacing="0"/>
           </process>
         </operator>
         <connect from_op="Generate Data" from_port="output" to_op="Generate Data (2)" to_port="example set input"/>
         <connect from_op="Generate Data (2)" from_port="example set output" to_op="Generate Data (3)" to_port="example set"/>
         <connect from_op="Generate Data (3)" from_port="example set" to_op="Merge" to_port="example set"/>
         <connect from_op="Merge" from_port="example set" 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>
  • Hi wessel,

    just in case your problem has meanwhile not been solved, this process should do the trick.
    By rotating the dataset and re-executing your "merge"-loop the single string appears.

    Best regards,
    Edin

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.006">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.2.006" expanded="true" name="Process">
        <process expanded="true" height="484" width="1016">
          <operator activated="true" class="generate_data" compatibility="5.2.006" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30">
            <parameter key="number_examples" value="2"/>
          </operator>
          <operator activated="true" class="select_attributes" compatibility="5.2.006" expanded="true" height="76" name="Generate Data (2)" width="90" x="180" y="30">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="label"/>
            <parameter key="invert_selection" value="true"/>
            <parameter key="include_special_attributes" value="true"/>
          </operator>
          <operator activated="true" class="loop_attributes" compatibility="5.2.006" expanded="true" height="60" name="Generate Data (3)" width="90" x="313" y="30">
            <parameter key="iteration_macro" value="att1"/>
            <process expanded="true" height="484" width="930">
              <operator activated="true" class="generate_attributes" compatibility="5.2.006" expanded="true" height="76" name="Generate Attributes" width="90" x="112" y="30">
                <list key="function_descriptions">
                  <parameter key="%{att1}" value="char(&quot;ABCDEFGHIJKLMNOP&quot;, round(abs(%{att1})))"/>
                </list>
              </operator>
              <connect from_port="example set" to_op="Generate Attributes" to_port="example set input"/>
              <connect from_op="Generate Attributes" from_port="example set output" to_port="example set"/>
              <portSpacing port="source_example set" spacing="0"/>
              <portSpacing port="sink_example set" spacing="0"/>
            </process>
          </operator>
          <operator activated="true" class="loop_attributes" compatibility="5.2.006" expanded="true" height="60" name="Merge" width="90" x="447" y="30">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="att5"/>
            <parameter key="invert_selection" value="true"/>
            <parameter key="iteration_macro" value="att1"/>
            <process expanded="true" height="484" width="930">
              <operator activated="true" class="generate_attributes" compatibility="5.2.006" expanded="true" height="76" name="Generate Attributes (2)" width="90" x="447" y="30">
                <list key="function_descriptions">
                  <parameter key="att5" value="concat(att5, %{att1})"/>
                </list>
                <parameter key="use_standard_constants" value="false"/>
              </operator>
              <connect from_port="example set" to_op="Generate Attributes (2)" to_port="example set input"/>
              <connect from_op="Generate Attributes (2)" from_port="example set output" to_port="example set"/>
              <portSpacing port="source_example set" spacing="0"/>
              <portSpacing port="sink_example set" spacing="0"/>
            </process>
          </operator>
          <operator activated="true" class="select_attributes" compatibility="5.2.006" expanded="true" height="76" name="Select Attributes" width="90" x="45" y="165">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="att5"/>
          </operator>
          <operator activated="true" class="transpose" compatibility="5.2.006" expanded="true" height="76" name="Transpose" width="90" x="179" y="165"/>
          <operator activated="true" class="loop_attributes" compatibility="5.2.006" expanded="true" height="60" name="Merge (2)" width="90" x="313" y="165">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="id"/>
            <parameter key="invert_selection" value="true"/>
            <parameter key="iteration_macro" value="att1"/>
            <process expanded="true" height="503" width="943">
              <operator activated="true" class="generate_attributes" compatibility="5.2.006" expanded="true" height="76" name="Generate Attributes (3)" width="90" x="246" y="30">
                <list key="function_descriptions">
                  <parameter key="final result" value="concat(att_1, %{att1})"/>
                </list>
                <parameter key="use_standard_constants" value="false"/>
              </operator>
              <connect from_port="example set" to_op="Generate Attributes (3)" to_port="example set input"/>
              <connect from_op="Generate Attributes (3)" from_port="example set output" to_port="example set"/>
              <portSpacing port="source_example set" spacing="0"/>
              <portSpacing port="sink_example set" spacing="0"/>
            </process>
          </operator>
          <operator activated="true" class="select_attributes" compatibility="5.2.006" expanded="true" height="76" name="Select Attributes (2)" width="90" x="447" y="165">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="final result"/>
            <parameter key="include_special_attributes" value="true"/>
          </operator>
          <connect from_op="Generate Data" from_port="output" to_op="Generate Data (2)" to_port="example set input"/>
          <connect from_op="Generate Data (2)" from_port="example set output" to_op="Generate Data (3)" to_port="example set"/>
          <connect from_op="Generate Data (3)" from_port="example set" to_op="Merge" to_port="example set"/>
          <connect from_op="Merge" from_port="example set" to_op="Select Attributes" to_port="example set input"/>
          <connect from_op="Select Attributes" from_port="example set output" to_op="Transpose" to_port="example set input"/>
          <connect from_op="Transpose" from_port="example set output" to_op="Merge (2)" to_port="example set"/>
          <connect from_op="Merge (2)" from_port="example set" to_op="Select Attributes (2)" to_port="example set input"/>
          <connect from_op="Select Attributes (2)" 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>
Sign In or Register to comment.