Search code examples
if-statementrapidminer

Rapid Miner - IF statements


I'm having a slight problem with my IF function expression in a generate attribute operator.

Essential this is the functionality I would like the function to have.

If VarX contains ".0", then remove this .0, else leave VarX unchanged

So far this is the syntax I have for the function expression in Rapid Miner.

if(contains(".0",VarX),replace(".0",VarX,""),VarX)

However this syntax is not working correctly, as the ".0" in the data are not being replaced.


Solution

  • The parameter ordering is incorrect.

    Try the following

    if(contains(VarX, ".0"), replace(VarX, ".0", ""),VarX)