-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy patho_eval.Rd
65 lines (51 loc) · 1.77 KB
/
o_eval.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/eval.R
\name{o_eval}
\alias{o_eval}
\title{Evaluate an Octave Expression}
\usage{
o_eval(..., CATCH, unlist = TRUE)
}
\arguments{
\item{...}{The Octave expression(s) to evaluate, as a character string.}
\item{CATCH}{The Octave expression(s) to evaluate if the evaluation(s) of
\code{...} fails. See section \emph{Octave Documentation} for more details.}
\item{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
}
\description{
Evaluates an Octave expression in the current embedded Octave
session. The variables assigned in the expression are available for
subsequent \code{o_eval} calls.
}
\section{Octave Documentation for \emph{evalin}}{
\Sexpr[results=rd,stage=render]{if( .Platform$OS.type != 'windows' || .Platform$r_arch != 'x64' ) RcppOctave::o_help(evalin, format='rd')}
\emph{[Generated from Octave-\Sexpr{RcppOctave::o_version()} on \Sexpr{Sys.time()}]}
}
\examples{
\dontshow{
options(R_CHECK_RUNNING_EXAMPLES_=TRUE) ## roxygen generated flag
}
# assign some variable
o_eval("a=10")
# retrieve its value in a subsequent call
o_eval("a")
\dontshow{ stopifnot( identical(o_eval("a"), 10) ) }
o_get('a')
# use its value
o_eval("b = a^2")
\dontshow{ 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
\dontrun{ o_eval("a=svd()") }
# except if argument CATCH is provided
o_eval("a=svd()", CATCH="a=2")
\dontshow{ stopifnot( identical(o_eval("a"), 2) ) }
}