Table Of Contents

7.16. R

7.16.1. Introduction


Our R API is currently in alpha release and is not recommended for production

This document is an introduction to the quasardb R API. It is primarily focused on timeseries, and will guide you through the various ways you can interact with the QuasarDB backend.

7.16.2. Requirements

7.16.3. Installation

On Unix-like systems, if you have quasardb C API installed system-wide, you can install quasardb R API directly from GitHub as follows:

if (!requireNamespace("devtools", quietly = TRUE)) {

For instructions on how to perform a clean build of the extension from source, please look at our GitHub repository.

7.16.4. Usage

Require the R library, and verify the C API version:


Establishing a connection

Connect to a QuasarDB cluster:

handle <- connect("qdb://")

Creating a timeseries

ts_create(handle, name = "timeseries1",
          columns = c("column1" = ColumnType$Blob, "column2" = ColumnType$Double))

This will create a timeseries with the a default shard size of 24h.

Retrieving timeseries

QuasarDB allows you to organise many different timeseries by tag. To look up these timeseries by tag, use the query_find:

keys <- query_find(handle, "find(tag='nyse' and type=ts)")

Executing queries

You can execute queries directly in R and process their results:

result <- query_find(handle, "select first(open), max(high) from find(tag='nasdaq' and type=ts) in range(today, -1y) group by day")