This is a beginner’s question but how do you save a 2d numpy array to a file in (compressed) R format using rpy2? To be clear, I want to save it in rpy2 and then later read it in using R. I would like to avoid csv as the amount of data will be large.
Share
Looks like you want the save command. I would use the pandas R interface and do something like the following.
There may be a more elegant way, though. I’m open to better suggestions. The above, in
Rwould be used:You can bypass the use of
pandasand use numpy2ri fromrpy2. With something like:In
Rthen: