0

I have a dataset in which I have N/A for each missing value, how can I change it into an actual missing value, inside the column itself.
I've been trying with the Rule Engine node but it just doesn't work..
Any suggestion?

plastico
  • 61
  • 1
  • 11

1 Answers1

6

Rule nodes will not work, but if you use a String Manipulation: toNull(regexReplace($x$, "^N/A$", "")) or a Java Snippet node (even simple): out_x = "N/A".equals(c_x) ? null : c_x; it is not very hard to replace that value with null, which KNIME will interpret in these cases as missing values.

Edit: I should add that the first option (with String Manipulation) will also replace the empty String to missing value and the regex's ^ means start of the String, $ end of the String. In case you would need special characters, you might also need \\Q/\\E in order to avoid escaping parts. I would recommend the simpler Java Snippet solution though it might be scary at first sight.

Gábor Bakos
  • 8,982
  • 52
  • 35
  • 52