I have a python S4 object that i want to store for future use in python using rpy2. I then wish to import this from a file back into R when required. How would I go about doing this?
Python 2.7 R 3.1.2
I have a python S4 object that i want to store for future use in python using rpy2. I then wish to import this from a file back into R when required. How would I go about doing this?
Python 2.7 R 3.1.2
In python you can start with observing the slot names of your R object as follows:
import rpy2.robjects as robjects
from rpy2.robjects.packages import importr, data
import rpy2.robjects.numpy2ri as rpynp
tuple(object.slotnames())
This gives the parameter names of your object. You could then see the parameter values:
x = object.slots['slotname']
I assume you can figure out how to save your data into a file and how to import it in R.
I hope this answers your question. I agree with @Ram that your question is not so clear. Good luck.