Learn R Programming

RcppOctave (version 0.11.3)

.CallOctave: Calling an Octave Function

Description

.CallOctave calls an Octave function and returns its value.

Usage

.CallOctave(.NAME, ..., argout = -1,
    unlist = !is.character(argout), buffer.std = 3L)

Arguments

.NAME
an Octave function name. The function must be a valid function name in the current Octave session.
...
arguments passed to the Octave function
argout
the number of output values, or a vector of names to use as output variable names. The names are directly used and applied to the result list in their original order.

The default value argout=-1 returns:

  • all output values whe

unlist
a logical that specifies if an output list of length one should be simplified and returned as a single value or kept as a list. The default is to unlist unless output names were passed in argout.
buffer.std
logical that indicates if Octave stdout or stderr should be buffered. If TRUE output/errors/warnings are displayed at the end of the computation. If FALSE they are directly displayed by Octave. It is also possible to sele

Value

  • the value returned by the Octave function -- converted into standard R objects.

Examples

Run this code
# data matrix
x <- matrix(1:9, 3)

# call Octave function 'svd': equivalent to [S] = svd(x). See o_help(svd)
.CallOctave('svd', x)

# call Octave function 'svd' asking for 3 output values: [U, S, V] = svd(x)
.CallOctave('svd', x, argout=3)

# call Octave function 'svd' asking for 3 named output values: [U, S, V] = svd(x)
.CallOctave('svd', x, argout=c('U', 'S', 'V'))

Run the code above in your browser using DataLab