---
title: "Introduction to the compenginets package"
author: "Yangzhuoran Fin Yang"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Introduction to the compenginets package}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

The goal of *compenginets* is to provide all the time series from  https://www.comp-engine.org/


## Installation

`compenginets` currently isn't on CRAN.
You can install the **development** version from
[Github](https://github.com/robjhyndman/compenginets)

```r
# install.packages("devtools")
devtools::install_github("robjhyndman/compenginets")
```

## CompEngine: A self-organizing database of time-series data

[CompEngine](https://www.comp-engine.org/) is an online time-series database which allow users to upload and interactively compare data with similar time series data set. The website was build by [Nick Jones](https://www.imperial.ac.uk/people/nick.jones) and [Ben Fulcher](http://www.benfulcher.com/), based on the early work conducted by Ben D. Fulcher, Max A. Little, and Nick S. Jones (2013). To provide time series similar to the data user uploads, it compute features of the data, and find existing time series matching those features. The features list and detailed description can be found on the [page](https://www.comp-engine.org/#!the-research) of CompEngine.

## Usage

This package intends to provide means to access data from CompEngine with ease with an `R` solution. Function `get_cets` can be used to return time series with a specified name or within a certain category. By default, `get_cets` returns the first 10 pages (maximum 10 in one page) time series within the category which matches argument `key`.

```{r usage}
library(compenginets)

# Get series within Finance category (including subcategory)
cets_finance <- get_cets("finance")
length(cets_finance)
str(cets_finance[[1]])

# Supply the number of pages need with option maxpage
# A maximum of 10 time series are in one page
cets_finance_20 <- get_cets("finance", maxpage = 2)
length(cets_finance_20)

# Switch category to FALSE to get the time series matching a name
W138_finance_m4 <- get_cets("M4_W138_Finance_1", category = FALSE)
str(W138_finance_m4)
```

A list of category can be obtained externally.

```{r category}
cate_path <- category_scraping()
str(cate_path, list.len = 10)
```




## Sources

[B.D. Fulcher, M.A. Little, N.S. Jones. Highly comparative time-series analysis: the empirical structure of time series and their methods. J. Roy. Soc. Interface 10, 20130048, 2013](https://royalsocietypublishing.org/doi/10.1098/rsif.2013.0048)


## License

This package is free and open source software, licensed under CC0
