Problem with save/load across R versions and OS

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with save/load across R versions and OS

Sebastien Bihorel
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?

Thanks

Sebastien

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with save/load across R versions and OS

Bert Gunter-2
Did you try plain save/load ??
Also ?dump/source
?dput/dget


Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Jul 17, 2019 at 1:38 AM Sebastien Bihorel <
[hidden email]> 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?
>
> Thanks
>
> Sebastien
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with save/load across R versions and OS

Duncan Murdoch-2
In reply to this post by Sebastien Bihorel
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

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with save/load across R versions and OS

Sebastien Bihorel
In reply to this post by Bert Gunter-2
Hi,

Yes, I tried save/load... same failure.
But I did not yet try dump/source or dput/dget. I will


From: "Bert Gunter" <[hidden email]>
To: "Sebastien Bihorel" <[hidden email]>
Cc: "R-help" <[hidden email]>
Sent: Wednesday, July 17, 2019 10:27:24 AM
Subject: Re: [R] Problem with save/load across R versions and OS

Did you try plain save/load ??
Also ?dump/source
?dput/dget


Bert Gunter

"The trouble with having an open mind is that people keep coming along and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Jul 17, 2019 at 1:38 AM Sebastien Bihorel < [ mailto:[hidden email] | [hidden email] ] > 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?

Thanks

Sebastien

______________________________________________
[ mailto:[hidden email] | [hidden email] ] mailing list -- To UNSUBSCRIBE and more, see
[ https://stat.ethz.ch/mailman/listinfo/r-help | https://stat.ethz.ch/mailman/listinfo/r-help ]
PLEASE do read the posting guide [ http://www.r-project.org/posting-guide.html | http://www.R-project.org/posting-guide.html ]
and provide commented, minimal, self-contained, reproducible code.





        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with save/load across R versions and OS

Sebastien Bihorel
In reply to this post by Duncan Murdoch-2
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" <[hidden email]>
To: "Sebastien Bihorel" <[hidden email]>, [hidden email]
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

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with save/load across R versions and OS

Duncan Murdoch-2
On 17/07/2019 2:02 p.m., Sebastien Bihorel wrote:
> 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.

I don't know about that approach.

You can probably produce a reprex, it'll just be work:  copy the
function from the contributed package, and edit it so that the line that
reads from the database just generates some fake data in a similar
format.  If you can make it reproducible, then cut out as much stuff as
possible, keeping it reproducible, and post the final minimal reprex.

It's likely to take some time, but also likely to lead to a solution
(either by you, when you notice a bug in the contributed package and can
fix it, or by one of us, when you post the reprex and we dig in).

Duncan Murdoch

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with save/load across R versions and OS

Sebastien Bihorel

Hi,

I managed to transfer my object trough dput/dget and a text file export. I will look into stripping the function for the reprex creation when I have more time (this is a ginormous function)...

Thanks to your input and Bert's


----- Original Message -----
From: "Duncan Murdoch" <[hidden email]>
To: "Sebastien Bihorel" <[hidden email]>
Cc: [hidden email]
Sent: Wednesday, July 17, 2019 3:04:46 PM
Subject: Re: [R] Problem with save/load across R versions and OS

On 17/07/2019 2:02 p.m., Sebastien Bihorel wrote:
> 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.

I don't know about that approach.

You can probably produce a reprex, it'll just be work:  copy the
function from the contributed package, and edit it so that the line that
reads from the database just generates some fake data in a similar
format.  If you can make it reproducible, then cut out as much stuff as
possible, keeping it reproducible, and post the final minimal reprex.

It's likely to take some time, but also likely to lead to a solution
(either by you, when you notice a bug in the contributed package and can
fix it, or by one of us, when you post the reprex and we dig in).

Duncan Murdoch

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.