Modules | R Documentation |
If called from the source directory of a package during installation, both pythonImport
and pythonAddToPath()
also set up
a load action for that package. The functional versions, not the methods themselves, should
be called from package source files to ensure that the load actions are created.
pythonImport(..., evaluator, where = topenv(parent.frame()))
pythonAddToPath(directory = "python",
package = utils::packageName(topenv(parent.frame())), pos = NA, evaluator,
where = topenv(parent.frame()))
... , where |
arguments for the |
evaluator |
The evaluator object to use. Supplying this argument suppresses the load action. |
directory |
the directory to add, defaults to "python" |
package , pos |
arguments |
pythonImport
: Add the module and name information specified to the objects imported for Python evaluators.
pythonAddToPath
: Add the directory specified to the search path for future Python objects.
## Not run:
## How to search from a local directory, import a function from a file there
## and call the function.
## Including the evaluator argument causes the path change and import to happen
## right now, not in a package being loaded
ev <- RPython()
pythonAddToPath("/Users/me/myPython/", package = "",
evaluator = ev)
pythonImport("funEx", "foo", evaluator = ev)
pythonCall("foo", 1.1, 1.2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.