0

I need to pass a very big integer argument to python using reticulate call, But I can't seem to find a way to do this. Any suggestions on how to do this? See the python object is in int class but the R numeric is passed as float which is expected, But I have tried to use gmp and bit64 package in R to have this big integer in R but it is not passed as class int in python anyhow.

> library(reticulate)
> use_python("/usr/bin/python3")
> py_run_string("obj = 10**18;")
> py_eval('type(obj)')
<class 'int'>
> class(r_to_py(10^18))
[1] "python.builtin.float"  "python.builtin.object"
anonR
  • 849
  • 7
  • 26
  • Side question, can you pass the log of obj to python and convert in the python environment? – SteveM Feb 02 '21 at 13:29
  • It would be doable but in the original code I have to call a module's function which takes the int as input, so I need to somehow take 10^18 from R to python int format, I can use whatever format in R to define that value though, Just needs to be int in python environment. – anonR Feb 02 '21 at 14:27

0 Answers0