# R API

The `Rcatch22` package provides functionality for extracting the *catch22* feature set from time series data.

## Functions

### <mark style="color:purple;">catch22\_all</mark>

Automatically run every time-series feature calculation included in the *catch22* set.

```r
catch22_all(data, catch24 = FALSE)
```

#### Parameters

| Parameter | Type           | Description                                                                                                             |
| --------- | -------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `data`    | numeric vector | A numerical vector representing the input time series.                                                                  |
| `catch24` | logical        | A logical value indicating whether to include the mean and standard deviation features (*catch24*). Default is `FALSE`. |

#### Returns

A data frame containing the calculated feature values. The data frame has two columns: `names` (feature names) and `values` (corresponding feature values):

| Key      | Type | Description                              |
| -------- | ---- | ---------------------------------------- |
| `names`  | list | A list of catch22/catch24 feature names. |
| `values` | list | Corresponding list of feature values.    |

#### Example Usage

<pre class="language-r"><code class="lang-r"><strong>data &#x3C;- rnorm(100)
</strong><strong>
</strong><strong>% features with standard catch22
</strong>features &#x3C;- catch22_all(data)

% features with catch24
features_with_catch24 &#x3C;- catch22_all(data, catch24 = TRUE)
</code></pre>

***

### Individual Feature Methods

The `Rcatch22` package provides direct access to the individual feature extraction methods implemented in C. These methods can be called directly using their respective function names (as given by the **long** name in the [table of features](https://time-series-features.gitbook.io/catch22/information-about-catch22/feature-descriptions/feature-overview-table)):

#### Syntax

```
% example of a single feature, replace with feature name of interest
DN_HistogramMode_5(data)
```

#### Parameters

| Parameter | Type           | Description                                            |
| --------- | -------------- | ------------------------------------------------------ |
| `data`    | numeric vector | A numerical vector representing the input time series. |

#### Returns

| Value   | Type   | Description                   |
| ------- | ------ | ----------------------------- |
| `value` | double | Corresponding feature output. |

#### Example Usage

```r
data <- rnorm(100)
mode_5 <- DN_HistogramMode_5(data)
mean_value <- DN_Mean(data)
```

***
