Contents

Overview

Usage:

import betterr.baser;

This module exposes some base R functionality to D.

Source Code and Examples

Functions

These functions take a single argument, and function similar to the underlying R functions. Links are to the R documentation, which provides everything you need to know. Where it applies, you can call the functions with D scalars or arrays.

These functions are the same as those above, but take an optional second argument. If set to true, NA values are removed before the calculation is done.

These functions take optional arguments. At this time, the optional arguments are a string (with comma separating arguments) that is passed directly to R. See the R documentation for the available optional arguments.

Finally, we have

seq(double from, double including, double by)

Note that these do not need to be integers, so this function is different from R’s : operator.

R documentation

Fast Fundamental Operations

Although the primary goal of this project is to provide all of R’s functionality to D programs, relying on R for fundamental building blocks such as summation or calculating the mean will lead to a serious performance hit. As an example, look at what happens if we use the R interpreter to calculate the mean of a double[]:

That’s not a problem if you’re going to calculate the mean of a double[100] one time. If you’re going to calculate the mean of a double[] holding tens of thousands of elements on the inside of a loop that’s executed a billion times, the above is ridiculously inefficient. To the extent possible, we want to make sure this type of operation is performant, so what actually happens under the hood is that the mean is calculated by Mir. The following operations currently have efficient implementations using Mir or Phobos:

The following make use of R due to lack of an alternative implementation:


Index    Repo