How do I replace a value for a field if the value is lesser than 0.02 by "Good"?
Value | Key | date |
0.02 | 1 | 1/1/2017 |
0.02 | 1 | 1/2/2017 |
0.05 | 1 | 1/3/2017 |
0.02 | 1 | 1/4/2017 |
0.02 | 1 | 1/5/2017 |
0.02 | 1 | 1/6/2017 |
Suppose the value is lesser than 0.02, I want to replace the value by string "Good"
Value | Key | date |
Good | 1 | 1/1/2017 |
Good | 1 | 1/2/2017 |
0.05 | 1 | 1/3/2017 |
Good | 1 | 1/4/2017 |
Good | 1 | 1/5/2017 |
Good | 1 | 1/6/2017 |
| eval Value=if(Value<=0.02,"Good",Value)
I get this error:
Error in 'eval' command: Type checking failed. The '<=' operator received different types.
When I use a single quote outside the value, I get No result
| eval Value=if(Value<='0.02',"Good",Value)
It is Value that you need to convert to a number for the numeric comparison to work not converting the number to a string
| eval Value=if(tonumber(Value)<=0.02,"Good",Value)