Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple OpenRefine IF to create a new column

Im trying to create a new column which contains true or false. Basically column A has a number in it, between 1 and 6, if its higher than 3 I want the new column 'match' to contain true, otherwise it contains false. Using the add column based on column in trying the following GREL

if(value > 5, "True", "False")

That basically results in EVERYTHING being false.

I know my IF statement is correct because the following works

if(value.length() > 1, "Double", "Single")

Im just confused why if Value is greater than 5 doesnt work, its obviously missing something but I cant seem to pinpoint it in the docs.

like image 792
Paul M Avatar asked Oct 13 '16 16:10

Paul M


1 Answers

Your GREL if() is correct. Our docs for that are here: https://github.com/OpenRefine/OpenRefine/wiki/GREL-Controls

But I wonder if you really have all number values in that Column ? Are all the values "green" color ? If not, try using Edit Column to Trim Whitespace and then convert the Text to Numbers. Then try your if() on that column again and see what happens.

like image 196
Thad Guidry Avatar answered Oct 03 '22 02:10

Thad Guidry