The Macrobond API for R


Macrobond offers an API that can be used in R for Windows.

  • Download any time series including values, dates and metadata.
  • Convert a set of time series to a common calendar and optionally a common currency.
  • Fill in missing values with a selection of methods.
  • Upload your own series to the in-house database which can then be used in the Macrobond application and optionally shared with others.

To successfully use the API, you might want to learn more about the database and metadata.


The API requires Macrobond to be installed and functioning on the computer where R is run. We provide a package for R 3.2 - 4.0. We have tested  R 3.2.2, R 3.4.0 and 3.3.1 (Macrobond API 1.0-3) as well as R 3.5.0 - 4.1.0 (Macrobond API 1.1-1). If you are running the 64-bit version of R, you need to use the 64-bit version of Macrobond.

The Macrobond API uses the "xts" package and requires version 0.9-7 of that package.

NB! We test that the API works with R.exe and RGui.exe. When R is used as an embedded component in other programs, it might or might not work. You need to test this yourself and we can only give limited support in those cases.

This document refers to Macrobond application version 1.24 and Macrobond API for R version 1.2-1.


The Macrobond R API comes in the form of an R binary package called "MacrobondAPI" from the Macrobond repository at (you cannot browse to that URL). Here are two ways to install the Macrobond API package.

Method 1: Add the Macrobond repository to the list of repositories

You can add this repository to the list of repositories that R will search in various ways. One option is to use the command:

setRepositories(addURLs = c(Macrobond = ""))

or add the repository to the configuration file. See ?setRepositories for details.

Once you have added the Macrobond repository to your list of repositories, you can just run this R command:

install.packages("MacrobondAPI", type="win.binary")

Method 2: Explicitly specify the repository

  1. Restart R
  2. If you do not have "xts" installed, install it by install.packages("xts"). If you have "xts" installed, make sure you have the latest version by running update.packages("xts").
  3. Install the MacrobondAPI package by running install.packages("MacrobondAPI", type="win.binary", repos="").

Upgrading the Macrobond API

  1. Restart R
  2. Run update.packages(repos="", type="win.binary").

We urge you to keep your Macrobond API for R up to date. We also suggest that you periodically upgrade the Macrobond application as described here.


Once you have installed the Macrobond API package, you can view the documentation from R like this:


You can view documentation for a specific function directly like this:


While using help available directly from within R - as described above - is the recommended way of reading the Macrobond R API documentation, you can also view it online.


There are plenty of examples in the reference documentation. There is an overview and a collection of examples to help you get started on the overview page. Most help pages for the functions have additional examples.


The Macrobond R API uses the license GPL-2. It uses portions of an enhanced version of RDCOMClient. There is a source package available.


If you're having problems with the Macrobond R connector please contact us via and:

  • Describe what you’re trying to achieve
  • Include the relevant code you tried to run
  • Provide information about version of Macrobond, R and the Macrobond’s R add–in. To do it, issue those two commands:

and send us the output.