Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Operation between two vectors. op is one of the operators below :

+ Addition

- Subtraction

* Multiplication

/ Division

^ Power

 

 

The vectors returned by these boolean operators are boolean vectors (containing only 1 where result is true, 0 where it is false) :

> Larger Than

< Smaller Than

>= Larger or Equal

<= Smaller or Equal

= Equal

<> Not Equal

 

In all of the above operations, a missing value in one of the input vectors results in a corresponding missing value in the output vector.

...

# copies fields 1, 5, 9, 13, 17 of x into y
Y = X[1,20,4]


vector vector[vector]

Extract a selection of elements from a vector. The vector supplied as the argument provides the set of indices to be used. For example:

v = |10, 20, 30, 40|
i = |2, 1, 3|
r = v[i] # r is now |20, 10, 30|   


Excerpt
vector abs( vector )

...

Takes two vectors, and returns a new vector containing only the values of the first vector where the second vector's values are non-zero and non-missing. Examples:

 

v1 = filter(v, v>273.15) # returns only the values above 273.15
v2 = filter(v, v <> vector_missing_value) # returns only the non-missing values

 

Excerpt

number or vector find( vector,number )
number or vector find( vector,number,string )

Searches the given vector for a number and returns the index of the first occurrence of it. If an optional third argument is given as the string 'all', then a vector of the indexes of all occurrences of the number is returned. In both cases, if the number is not contained in the vector, nil is returned.

 

Excerpt
vector int( vector )

...