---
title: "Tutorial / vignette for the oenb R package"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{oenb}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

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

## Introduction

The `oenb` R packages provides tools to access statistical data via the [web service of the Austrian central bank](https://www.oenb.at/en/Statistics/User-Defined-Tables/webservice.html) (Oesterreichische Nationalbank, OeNB).

## Installation

```{r cran, eval = FALSE} 
install.packages("oenb") 
```

### Development version

```{r github, eval = FALSE}
# install.packages("devtools")
devtools::install_github("franzmohr/oenb")
```

## Usage

```{r, eval = FALSE}
library("oenb")
```

### Table of contents

A table of available data sets can be obtained with the function `oenb_toc`. Its output contains the ID of the data set with a short description.

```{r, eval = FALSE}
toc <- oenb_toc()
head(toc)
```

### Dataset overview

Each data set contains a series of indicators. The function `oenb_dataset` can be used to obtain a table of available series for a given data set. Its output contains the position code of a series and a short description.

```{r, eval = FALSE}
overview <- oenb_dataset(id = "11")
head(overview)
```

### Attributes of a series

Many series are available in different forms. The function `oenb_attributes` obtains a table of available query specifications of a given series.

```{r, eval = FALSE}
attrib <- oenb_attributes(id = "11", pos = "VDBFKBSC217000")
attrib
```

Furthermore, series are available in different frequencies. The function `oenb_frequency` can be used to obtain the available frequencies of a given series and the periods, for which data are available.

```{r, eval = FALSE}
freq <- oenb_frequency(id = "11", pos = "VDBFKBSC217000")
freq
```

### Data download

Series of a data set can be downloaded with the `oenb_data` function.

```{r, eval = FALSE}
series <- oenb_data(id = "11", pos = "VDBFKBSC217000", attr = c("dval3" = "AT"))
```

### Metadata

Metadata on a specific series can be obtained with the function `oenb_metadata`.

```{r, eval = FALSE}
meta <- oenb_metadata(id = "11", pos = "VDBFKBSC217000")
meta
```

