Learn R Programming

RcppOctave (version 0.9.5)

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)

## S3 method for class 'OctaveFunction': show(object)

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 comp
object
Any R object

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