# 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](/catch22/information-about-catch22/feature-descriptions/feature-overview-table.md)):

#### 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)
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://time-series-features.gitbook.io/catch22/information-about-catch22/api-reference/r-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
