The following code is to bind Python file with R
library(PythonInR)
library(RcppCNPy)
if ( !pyIsConnected() ) {
autodetectPython()
pyConnect()
}
and continue.....