next up previous contents
Next: Selecting fields into a Up: Basic operations for managing Previous: Querying the vector lenght

Setting the contents of a data field

 

setdata Put data values according to indexes into a data field
-f <fldname> field to be modified
-vals <index> = <value> ...; index - value pairs
[-len <len>] length of the field to be created
[-t <type>] type of the field to be created

This command places specified data values according to indexes into a specified data field. The values are given as index - value pairs. If a field does not exist, then the parameters <len> and <type> must be given. The type is specified with one of the strings int, float or string. Note, that a strong conversion is used. This means that if an integer is given for a string field, the value is handled as a string, and the same holds for all other data types. Vector elements, whose value is not specified, receive a zero or empty value.

Example: In the following examples, the range (min/max) is computed using fldstat (see section 4.5) into frame minmax. The first field contains the minimum and the second field the maximum values for each original field. Therefore, index 0 of frame minmax refers to the first field in the source data (boston.criminality). Thus, the operation setdata forces the minimum value for criminality to 5 and maximum to 50.

NDA> load boston.dat
NDA> fldstat -d boston -dout minmax -min -max
NDA> ls -fr minmax
 minmax.min
 minmax.max
NDA> setdata -f minmax.min -vals 0=5;
NDA> setdata -f minmax.max -vals 0=50;



Anssi Lensu
Wed Oct 6 12:57:48 EET DST 1999