pyObject: Creates a virtual Python object

Description Usage Arguments Details Examples

View source: R/PyObject.R

Description

The function pyObject creates a virtual Python object of type PythonInR_Object.

Usage

1
2
3
pyObject(key, regFinalizer = TRUE)

is.PythonInR_Object(x)

Arguments

key

a character string giving the name of the Python object.

regFinalizer

a logical indicating if a finalizer should be be registered, the default value is TRUE.

x

an R object.

Details

Every PythonInR_Object has the following members:

The other members of PythonInR_Object's are generated dynamically based on the provided Python object. The R function ls can be used to view the members of a PythonInR_Object object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
if ( pyIsConnected() ){
pyExec("import os")
os <- pyObject("os", regFinalizer = FALSE)
ls(os)
## To show again the difference between pyGet and pyGet0.
os1 <- pyGet0("os") ## has no finalizer
os2 <- pyGet("os")  ## has a finalizer
os$.name
os1$.name
os2$.name
}

PythonInR documentation built on May 2, 2019, 5:17 p.m.