RVector

This struct is used to work with a vector that has been allocated in R. A pointer to the data is held, along with the dimensions. An RVector struct is reference counted to take care of protecting it from the R garbage collector while in use, and unprotecting when it is no longer used, as necessary.

You can refer to elements using standard vector notation, i.e., v[4].

Vectors and matrices are different objects in R.

Constructors

this
this(int r)

Allocate a vector with room for 30 elements in R.

this
this(Robj rv, bool u = false)

You should only use this function if you understand the internal workings of this library.

this
this(string name)

Pull a vector from an R interpreter embedded inside a D program.

this
this(T v)

Allocates a new vector in R with v.length elements and copies the elements of v into it.

Alias This

mat

Members

Functions

array
double[] array()

Create a new double[] and copy the contents of the current RVector into it.

empty
bool empty()
front
double front()

RVector is a range. You can use it with foreach.

length
int length()

Returns the number of elements.

mat
GretlMatrix mat()

Create a reference to the data in a matrix with one column.

opAssign
void opAssign(T x)
opIndex
double opIndex(int r)
opIndex
RVector opIndex(int[] obs)

Pull out the elements with index values in obs.

opIndexAssign
void opIndexAssign(double v, int r)
opSlice
RVector opSlice(int i, int j)

Returns a reference to a slice of an RVector as a new RVector.

popFront
void popFront()

RVector is a range. You can use it with foreach.

print
void print(string msg = "")

Prints the contents of an RVector struct with an optional message.

robj
Robj robj()

Get the underlying Robj that will be returned to R.

Meta