# R

## R Usage Guide

Select a card below to access R-specific usage information.&#x20;

<table data-view="cards"><thead><tr><th></th><th align="center"></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td></td><td align="center"><strong>Installation</strong></td><td></td><td><a href="/files/RjBXWwudtJom3W0YZ4Wr">/files/RjBXWwudtJom3W0YZ4Wr</a></td><td><a href="/pages/zUyIwBNGt7wzqBQotr9k#installation">/pages/zUyIwBNGt7wzqBQotr9k#installation</a></td></tr><tr><td></td><td align="center"><strong>Getting started</strong></td><td></td><td><a href="/files/bFj9bJ7rv8qOMAII7SL3">/files/bFj9bJ7rv8qOMAII7SL3</a></td><td><a href="/pages/zUyIwBNGt7wzqBQotr9k#getting-started-basic-usage">/pages/zUyIwBNGt7wzqBQotr9k#getting-started-basic-usage</a></td></tr><tr><td></td><td align="center"><strong>Advanced usage</strong></td><td></td><td><a href="/files/VUJsCdie24uH1M2Up8Vk">/files/VUJsCdie24uH1M2Up8Vk</a></td><td><a href="/pages/zUyIwBNGt7wzqBQotr9k#advanced-usage">/pages/zUyIwBNGt7wzqBQotr9k#advanced-usage</a></td></tr><tr><td></td><td align="center"><strong>Frequently Asked Questions</strong></td><td></td><td><a href="/files/KY7KscsTH3h3TIdqsykd">/files/KY7KscsTH3h3TIdqsykd</a></td><td><a href="/pages/zUyIwBNGt7wzqBQotr9k#faq">/pages/zUyIwBNGt7wzqBQotr9k#faq</a></td></tr><tr><td></td><td align="center"><strong>API Reference</strong></td><td></td><td><a href="/files/jpNU8GYrp0jeA1wxdg8E">/files/jpNU8GYrp0jeA1wxdg8E</a></td><td><a href="/pages/fRku7qUony6ug2h2AUAL">/pages/fRku7qUony6ug2h2AUAL</a></td></tr></tbody></table>

***

***

## Installation

***

You can install the stable version of *Rcatch22* from [CRAN](https://cran.r-project.org/web/packages/Rcatch22/readme/README.html) using the following:

```r
install.packages("Rcatch22")
```

***

## Getting Started: Basic Usage

Here we outline how you can jump straight into computing *catch22* features on your time series data with a basic usage example.

### Expected Input

*Rcatch22* expects a **single univariate time series** as a **numeric** vector with length equal to the number of points in the time series. For example, consider a time series with length 100:

```r
library(Rcatch22)
data <- stats::rnorm(100) # your time series data
```

### Computing *catch22* features

To compute *catch22* features, call the `catch22_all` function on your time series data as follows:

```r
outs22 <- catch22_all(data)
```

### Expected output

A data frame is returned with two columns: `names` and `features` as shown below

```
outs22
##                                          names       values
## 1                           DN_HistogramMode_5  0.432653377
## 2                          DN_HistogramMode_10  0.174395817
## 3                                    CO_f1ecac  1.865299453
...                                ...                 ...
## 21            SP_Summaries_welch_rect_centroid  1.178097245
## 22                 FC_LocalSimple_mean3_stderr  1.201213638
```

To access the full list of feature names, you can also run `feature_list.`

And that's it! You now have all the knowledge you need to apply *catch22* to your time series data. To access some of the additional functionality of *catch22*, keep reading for advanced usage tips and examples.

***

***

## Advanced Usage

Ready to explore some of the additional functionality of *Rcatch22?*&#x20;

### 1. *Catch24*

If the location and spread of the raw time series distribution may be important for your application, you can enable *catch24.*

{% tabs %}
{% tab title="Catch24" %}
*Catch24* is an extension of the original *catch22* feature set to include **mean** and **standard deviation,** yielding a total of **24** time series features. An option to include the mean and standard deviation as features in addition to *catch22* is available through setting the *catch24* argument to `TRUE`:

```r
library(Rcatch22)

x <- 1 + 0.5 * 1:1000 + arima.sim(list(ma = 0.5), n = 1000)
features <- catch22_all(x, catch24 = TRUE)
```

{% endtab %}
{% endtabs %}

### 2. Computing Individual Features

If you do not wish to compute the full *catch22* feature set on your time series, you can alternatively compute each feature (including mean and std. deviation) individually.

{% tabs %}
{% tab title="Computing Individual Features" %}
In *pycatch22* each feature function can be accessed individually and takes **arrays** as **tuples** or To compute individual features in *Rcatch22*, you can access the feature functions using their unique names (as shown in the [feature overview table](/catch22/information-about-catch22/feature-descriptions/feature-overview-table.md)). Note that feature functions are given by the feature long name e.g.,`IN_AutoMutualInfoStats_40_gaussian_fmmi`.

For example, let's compute the feature `IN_AutoMutualInfoStats_40_gaussian_fmmi` on a single univariate time series:

```r
library(Rcatch22)
x <- 1 + 0.5 * 1:1000 + arima.sim(list(ma = 0.5), n = 1000)
f <- IN_AutoMutualInfoStats_40_gaussian_fmmi(x)
```

{% endtab %}
{% endtabs %}

***

## FAQ

***

Click one of the expandable tabs below to explore commonly asked questions about *Rcatch22*:

<details>

<summary>How does computational time scale as a function of time series length in Rcatch22?</summary>

With features coded in C, *Rcatch22* is highly computationally efficient, scaling nearly linearly with time series size. Computation time in seconds for a range of time series lengths is presented [here](https://github.com/hendersontrent/Rcatch22?tab=readme-ov-file#computational-performance).&#x20;

</details>

<details>

<summary>How can I submit a bug report for <em>Rcatch22?</em> </summary>

If you would like to submit a bug report, you can access our Bug Tracker [here](https://github.com/hendersontrent/Rcatch22/issues). For guidelines on submitting an ideal bug report, see our page on [contributing to *catch22*](/catch22/information-about-catch22/contributing-to-catch22.md)*.*&#x20;

</details>

***


---

# 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/language-specific-docs/r.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.
