library(rpymat)
if(interactive() && dir.exists(env_path())) {
# tuple
x <- tuple(1, 2, "a")
print(x)
# convert to R object
py_to_r(x)
# convert R object to python
y <- r_to_py(list(a = 1, b = "s"))
# get element
py_get_item(y, "a")
# get missing element
py_get_item(y, "c", silent = TRUE)
}
Run the code above in your browser using DataLab