o_eval: Evaluate an Octave Expression

Description Usage Arguments Value Octave Documentation for evalin Examples

View source: R/eval.R

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

1
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 evalin

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

[Generated from Octave-\Sexpr{RcppOctave::o_version()} on \Sexpr{Sys.time()}]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# assign some variable 
o_eval("a=10")

# retrieve its value in a subsequent call
o_eval("a")

o_get('a')

# use its value
o_eval("b = a^2")


# 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
## Not run:  o_eval("a=svd()") 

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

renozao/RcppOctave documentation built on June 30, 2017, 2:11 p.m.