Learn R Programming

reticulate (version 0.7)

import: Import a Python module

Description

Import the specified Python module for calling from R.

Usage

import(module, convert = TRUE, delay_load = FALSE)

import_main(convert = TRUE)

import_builtins(convert = TRUE)

Arguments

module
Module name
convert
TRUE to automatically convert Python objects to their R equivalent. If you pass FALSE you can do manual conversion using the py_to_r() function.
delay_load
TRUE or a function to delay loading the module until it is first used (if a function is provided then it will be called once the module is loaded). FALSE to load the module immediately.

Value

A Python module

Examples

Run this code
## Not run: ------------------------------------
# main <- import_main()
# sys <- import("sys")
## ---------------------------------------------

Run the code above in your browser using DataLab