exec.code: exec.code

Description Usage Arguments Value Examples

View source: R/methods.r

Description

Execute code from string.

Usage

1
val <- exec.code(<expr1>, <expr2>, ..., multi.lines=<BOOL>)

Arguments

multi.lines

boolean. Default FALSE. If TRUE, the expressions are interpretted as separate lines of code. If FALSE, the expressions will be concatenated with no spaces and interpretted as a single expression to be executed.

<expr1>

String. 1 or more. R code as string expressions.

Value

val Optional. Returns the value of the last line executed.

Examples

1
2
3
4
5
6
7
## Not run: 
	key <- 'fleisch';
	basket <- list('obst'='Birne', 'fleisch'='Hähnchen', 'vegetable'='Spinat');
x <- exec.code('basket$',key); # 'Hähnchen'
exec.code("key <- 'fleisch';", "x<-basket[[key]];", "show(x);", multi.lines=TRUE);
 
## End(Not run)

RLogik/rbettersyntax documentation built on Aug. 1, 2020, 10:44 p.m.