[R] Problem with save/load across R versions and OS

Sebastien Bihorel @eb@@t|en@b|hore| @end|ng |rom cogn|gencorp@com
Wed Jul 17 20:02:36 CEST 2019


Hi,

Indeed the S4 object is a class provided by a contributed package. However, the windows machine that reads the .rds fine does not even have the package installed.

I also confirm that I used readRDS (loadRDS was a typo on my part, sorry).

In this case, I cannot provide a reprex as the contributed package function that creates the S4 object connects to a local database with secured access. I could send the code, but only the authorized people could run it. This is not the ideal situation for problem solving...

I was wondering if there was a pathway through serialize / unserialize. I tried but I could not find the way to properly write and read the serialized object.

Thanks

----- Original Message -----
From: "Duncan Murdoch" <murdoch.duncan using gmail.com>
To: "Sebastien Bihorel" <sebastien.bihorel using cognigencorp.com>, r-help using r-project.org
Sent: Wednesday, July 17, 2019 10:42:13 AM
Subject: Re: [R] Problem with save/load across R versions and OS

On 17/07/2019 4:39 a.m., Sebastien Bihorel wrote:
> Hi,
> 
> I am trying to transfer an S4 object from a machine working with CentOS 7.2 / R 3.4.3 to another one running Linux Mint 19 / R 3.6.0. If I save the object using saveRDS in obj.rds, loadRDS returns an "unknown input format" error on my Linux Mint machine. Interestingly enough, obj.rds loads just fine in a 3rd machine running Windows Server 2012 / R 3.4.3. I tried also using save and load and various values of the ascii and compression arguments, but still no cigar...
> 
> Do you have recommendations on how to successfully transfer my object to my Linux Mint machine?
> 


Normally such a transfer should just work.  Reasons why it might not:

  - The error is being triggered by a contributed package somehow.  Do 
contributed package versions match?

  - There's no loadRDS function in base R, the base R function is 
readRDS.  If that's not just a typo above, then the loadRDS function 
you're using doesn't work.  Use the base package functions instead.

  - There's a bug in R.

In any case, we can't do much to help you without a reproducible example.

Duncan Murdoch



More information about the R-help mailing list