Learn R Programming

RcppOctave (version 0.18.1)

o_eval: Evaluate an Octave Expression

Description

Evaluates an Octave expression in the current embedded Octave session. The variables assigned in the expression are available for subsequent o_eval calls.

Usage

o_eval(..., CATCH, unlist = TRUE)

Arguments

...
The Octave expression(s) to evaluate, as a character string.
CATCH
The Octave expression(s) to evaluate if the evaluation(s) of ... fails. See section Octave Documentation for more details.
unlist
a logical that specifies it single variables should be returned as a single value (default), or as a list.

Value

  • the result of the evaluation

Octave Documentation for <em>evalin</em>

[results=rd,stage=render]{if( .Platform$OS.type != 'windows' || .Platform$r_arch != 'x64' ) RcppOctave::o_help(evalin, format='rd')}

[Generated from Octave-RcppOctave::o_version() on Sys.time()]

# roxygen generated flag options(R_CHECK_RUNNING_EXAMPLES_=TRUE)

# assign some variable o_eval("a=10")

# retrieve its value in a subsequent call o_eval("a") stopifnot( identical(o_eval("a"), 10) ) o_get('a')

# use its value o_eval("b = a^2") stopifnot( identical(o_eval("b = a^2"), 100) )

# multiple expression can be evaluated o_eval(a="10^3", singular="svd(rand(4,4))", random="rand(10, 1)") # or from a list l <- list(a="10^3", singular="svd(rand(4,4))", random="rand(10, 1)") o_eval(l)

# if the evaluation fails then an error is thrown o_eval("a=svd()")

# except if argument CATCH is provided o_eval("a=svd()", CATCH="a=2") stopifnot( identical(o_eval("a"), 2) )