python.exec: python.exec

Description Usage Arguments Details Value Examples

Description

Executes Python code contained in an R character vector.

Usage

1
  python.exec( python.code, get.exception = TRUE )

Arguments

python.code

a character vector containing Python code, typically a single line with indentation and EOL characters as required by Python syntax

get.exception

logical value indicating whether to check or not for exceptions in Python

Details

This function runs Python code. It needs to be provided by the caller in a character vector.

The vector may consists of a single string with EOL and indentation characters embedded.

Alternatively, it can be a character vector, each entry containing one or more lines of Python code.

The get.exception option allows the user to disregard Python exceptions in cases where safe calls to avoid the overhead of checking for them.

Value

None. If the code produces some output, it is up to the caller to go and fetch if from Python.

Examples

1
2
3
4
a <- 1:4
b <- 5:8
python.exec( c( "def concat(a,b):", "\treturn a+b" ) )
python.call( "concat", a, b)

cjgb/rPython-win documentation built on May 13, 2019, 7:32 p.m.