Table Of Contents

Previous topic

pyPrint

Next topic

pyTuple

This Page

pySet

The function pySet allows to assign R objects to the Python namespace, the conversion from R to Python is done automatically.

More information about the type conversion can be found in the README file or at http://pythoninr.bitbucket.org/.

Usage

pySet(key, value, namespace = "__main__", useSetPoly = TRUE,
  useNumpy = pyOptions("useNumpy"), usePandas = pyOptions("usePandas"))

Arguments

key   a string specifying the name of the Python object.
value   a R object which is assigned to Python.
namespace   a string specifying where the key should be located. If the namespace is set to "__main__" the key will be set to the global namespace. But it is also possible to set attributes of objects e.g. the attribute name of the object 'os'.
useSetPoly   an optional logical, giving if pySetPoly should be used to transform R objects into Python objects. For example if useSetPoly is TRUE unnamed vectors are transformed to Python objects of type PrVector else to lists.
useNumpy   an optional logical, default is FALSE, to control if numpy should be used for the type conversion of matrices.
usePandas   an optional logical, default is FALSE, to control if pandas should be used for the type conversion of data frames.

Examples

pySet("x", 3)
pySet("M", diag(1,3))
pyImport("os")
pySet("name", "Hello os!", namespace="os")