# compare-columns

## Description

<mark style="color:purple;">`compare-columns`</mark> *adaptor checks whether values in two or more columns in a given datatable are the same or different.*

When all values in the specified `columns` are the same, the row is added to the `same` output datatable, otherwise the row is added to the `different` output datatable.

## Inputs

**`data`**\
Type: `datatable`\
Required: Yes\
The datatable containing columns to compare.

**`columns`**\
Type: `list`\
Required: Yes\
A list of columns to be compared.

**`case sensitive`**\
Type: `boolean`\
Required: No\
Whether lowercase and uppercase letters should be treated as equivalent. If unspecified, defaults to `False` (lowercase and uppercase letters are treated as equivalent).

## Outputs

**`same`**\
Type: `datatable`\
A datatable containing rows which have the same values in selected columns.

**`different`**\
Type: `datatable`\
A datatable containing rows which have different values in selected columns.

## Examples

### Example 1: Default behaviour.

#### Inputs:

`data`:

| Sample ID | A | B | C |
| --------- | - | - | - |
| Sample A  | R | R | R |
| Sample B  | S | R | S |
| Sample C  | R | S | I |
| Sample D  | I | R | R |
| Sample E  | R | r | R |
| Sample F  | r | r | r |

`columns`:

* A
* B
* C

`case sensitive`: *null (empty)*

#### Outputs:

`same`:

| Sample ID | A | B | C |
| --------- | - | - | - |
| Sample A  | R | R | R |
| Sample E  | R | r | R |
| Sample F  | r | r | r |

`different`:

| Sample ID | A | B | C |
| --------- | - | - | - |
| Sample B  | S | R | S |
| Sample C  | R | S | I |
| Sample D  | I | R | R |

-> Compared the columns `A`, `B` and `C` and return the rows with same and different values.

### Example 2: Case sensitive comparison.

#### Inputs:

`data`:

| Sample ID | A | B | C |
| --------- | - | - | - |
| Sample A  | R | R | R |
| Sample B  | S | R | S |
| Sample C  | R | S | I |
| Sample D  | I | R | R |
| Sample E  | R | r | R |
| Sample F  | r | r | r |

`columns`:

* A
* B
* C

`case sensitive`: True

#### Outputs:

`same`:

| Sample ID | A | B | C |
| --------- | - | - | - |
| Sample A  | R | R | R |
| Sample F  | r | r | r |

`different`:

| Sample ID | A | B | C |
| --------- | - | - | - |
| Sample B  | S | R | S |
| Sample C  | R | S | I |
| Sample E  | R | r | R |
| Sample D  | I | R | R |

-> Compared the columns `A`, `B` and `C` and return the rows with same and different case sensitive values.
