The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Replace mutliple att. values in function for Generate Attribute

fatou_ceesayfatou_ceesay Member Posts: 2 Contributor I
edited June 2019 in Help

Hi

I am trying to generate an attribute by text tranformation function. Below is my function:

replace(grade, "[75 - 100]", "Excellent"
 ,replace(grade, "[60 - 70]", "Very Good"
 ,replace(grade, "[40 - 50]", "Good"
 ,replace(grade, "[30 - 35]", "Poor"))))

 

I get Error: The function 'replace' must have 3 arguments but has 4.

Please assist.

Answers

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,533 RM Data Scientist

    Hi,

     

    did you try Map or Replace operators? Feels like they are more suited.

     

    Cheers,

    Martin

    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • fatou_ceesayfatou_ceesay Member Posts: 2 Contributor I

    Yes I have tried replace and map operators but they replace the values in the original attribute.

    What I want is to have the values replaced in a new attribute.

  • Telcontar120Telcontar120 RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,635 Unicorn
    You could Generate Copy of the original attribute first, and then Map or Replace as desired. That would let you both keep your original attribute unchanged and have the new values you want.
    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts
  • gmeiergmeier Employee-RapidMiner, Member Posts: 25 RM Engineering

    Hi,

     

    alternatively you could also fix your function like this

     

    replace(
        replace(
            replace(
                replace(grade, "[30 - 35]", "Poor"),
             "[40 - 50]", "Good"),
         "[60 - 70]", "Very Good"),
     "[75 - 100]", "Excellent")
Sign In or Register to comment.