Learn R Programming

RcppOctave (version 0.18.1)

OctaveFunction-class: Wrapping and Defining Octave Functions from R

Description

Wrapping and Defining Octave Functions from R

OctaveFunction objects can be created from existing Octave function using their name, or directly from their Octave implementation. In this case, the Octave code is parsed to extract and use the name of the first function defined therein.

Usage

OctaveFunction(fun, check = TRUE)

Arguments

fun
the name of an existing Octave function or, Octave code that defines a function.
check
logical that indicates if the existence of the Octave function should be checked. If function does not exist then, an error or a warning is thrown if check=TRUE or check=FALSE respectively. The existence check can be completly disabled with check=NA.

Slots

name
name of the wrapped Octave function

Examples

Run this code


osvd <- OctaveFunction('svd')
osvd
osvd(matrix(1:9,3))

orand <- OctaveFunction('rand')
orand()
orand(2)
orand(2, 3)

# From source code
myfun <- OctaveFunction('function [Y] = somefun(x)
	Y = x * x;
	end
')
myfun
myfun(10)

Run the code above in your browser using DataLab