next up previous contents
Next: Record selector Up: Field evaluator Previous: Expressions

Field calculator

  

tabular1139

The command works as a record calculator. A given expression is evaluated in loop for each data record. The result values are stored in a new field, and in a data frame if it has been given. See more about expressions in Section 4.2.1.

Example (ex4.3): The example shows some basic operations for fields and error messages.

NDA> load boston.dat
NDA> expr -dout boston -fout znprice
      -expr 'boston.rate' / ('boston.zn'+0.0001);
NDA> expr -dout boston -fout lowCrim -expr 'boston.crim' < 3;
...
# cannot divide by string
NDA> expr -dout boston -fout someVar -expr 'boston.dis' / "xxx";
-409
Operand type mismatch for operator
...



Erkki Hakkinen
Thu Sep 24 11:51:34 EET DST 1998