# in

Syntax

in(X, Y)

Arguments

X is a scalar/vector.

Y is a scalar, vector, dictionary, keyed or indexed table.

Details

If Y is a scalar, check if X and Y are equal. When Y is a NULL value, it returns false regardless of the value of X.

If Y is a vector, check if each element of X is an element in Y.

If Y is a dictionary, check if each element of X is a key in the dictionary Y.

If Y is a keyed table or an indexed table, check if each element of X appears in the key columns of Y.

Note: X and Y should be of the same data type. If they are of different types but belong to the same category, X will be converted to the same type as Y.

Examples

```\$ in(3 3 5 2, 2 3);
[1,1,0,1]

\$ x=dict(`int,`double);
\$ x[1, 2, 3]=[4.5, 6.6, 3.2];
\$ x;
3->3.2
1->4.5
2->6.6

\$ in(1..6, x);
[1,1,1,0,0,0]

\$ kt = keyedTable(`name`id,1000:0,`name`id`age`department,[STRING,INT,INT,STRING])
\$ insert into kt values(`Tom`Sam`Cindy`Emma`Nick, 1 2 3 4 5, 30 35 32 25 30, `IT`Finance`HR`HR`IT)
\$ in((`Tom`Cindy, 1 3), kt);
[1,1]

\$ t1 = indexedTable(`sym`side, 10000:0, `sym`side`price`qty, [SYMBOL,CHAR,DOUBLE,INT])
\$ insert into t1 values(`IBM`MSFT`GOOG, ['B','S','B'], 10.01 10.02 10.03, 10 10 20)
\$ in((`IBM`MSFT, ['S','S']), t1);
[0,1]
```

Related functions: find, binsrch.