saveRDS() and readRDS() Why?

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

saveRDS() and readRDS() Why?

Patrick Connolly-4
From a Windows R session, I do
 
> object.size(rawData)
31736 bytes  # from scraping a non-reproducible web address.
> saveRDS(rawData, file = "rawData.rds")

Then copy to a Linux session

> rawData <- readRDS(file = "rawData.rds")
> rawData
[1] "rawData"
> object.size(rawData)
112 bytes
> rawData
[1] "rawData" # only the name and something to make up 112 bytes
>

Have I misunderstood the syntax?

It's an old version on Windows.  I haven't used Windows R since then.

major          3                                          
minor          2.4                                        
year           2016                                      
month          03                                        
day            16                                        


I've tried R-3.5.0 and R-3.5.1 Linux versions.

In case it's material ...

I couldn't get the scraping to work on either of the R installations
but Windows users told me it worked for them.  So I thought I'd get
the R object and use it.  I could understand accessing the web address
could have different permissions for different OSes, but should that
affect the R objects?

TIA

--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.  
   ___    Patrick Connolly  
 {~._.~}                   Great minds discuss ideas    
 _( Y )_           Average minds discuss events
(:_~*~_:)                  Small minds discuss people  
 (_)-(_)                        ..... Eleanor Roosevelt
         
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

______________________________________________
[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: saveRDS() and readRDS() Why?

Eric Berger
What do you see at the OS level?
i.e. on windows
DIR rawData.rds
on linux
ls -l rawData.rds
compare the file sizes on both.


On Wed, Nov 7, 2018 at 9:56 AM Patrick Connolly <[hidden email]>
wrote:

> From a Windows R session, I do
>
> > object.size(rawData)
> 31736 bytes  # from scraping a non-reproducible web address.
> > saveRDS(rawData, file = "rawData.rds")
>
> Then copy to a Linux session
>
> > rawData <- readRDS(file = "rawData.rds")
> > rawData
> [1] "rawData"
> > object.size(rawData)
> 112 bytes
> > rawData
> [1] "rawData" # only the name and something to make up 112 bytes
> >
>
> Have I misunderstood the syntax?
>
> It's an old version on Windows.  I haven't used Windows R since then.
>
> major          3
> minor          2.4
> year           2016
> month          03
> day            16
>
>
> I've tried R-3.5.0 and R-3.5.1 Linux versions.
>
> In case it's material ...
>
> I couldn't get the scraping to work on either of the R installations
> but Windows users told me it worked for them.  So I thought I'd get
> the R object and use it.  I could understand accessing the web address
> could have different permissions for different OSes, but should that
> affect the R objects?
>
> TIA
>
> --
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>    ___    Patrick Connolly
>  {~._.~}                   Great minds discuss ideas
>  _( Y )_                 Average minds discuss events
> (:_~*~_:)                  Small minds discuss people
>  (_)-(_)                              ..... Eleanor Roosevelt
>
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>
> ______________________________________________
> [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: saveRDS() and readRDS() Why?

R help mailing list-2
Hi Patrick,

 From the help: "save writes a single line header (typically "RDXs\n")
before the serialization of a single object".

If the file sizes are the same (see Eric's message), then the problem
may be due to different line terminators. Try serialize and unserialize
for low-level control of saving/reading objects.

Rgds,

Robert


On 07/11/18 08:13, Eric Berger wrote:

> What do you see at the OS level?
> i.e. on windows
> DIR rawData.rds
> on linux
> ls -l rawData.rds
> compare the file sizes on both.
>
>
> On Wed, Nov 7, 2018 at 9:56 AM Patrick Connolly <[hidden email]>
> wrote:
>
>>  From a Windows R session, I do
>>
>>> object.size(rawData)
>> 31736 bytes  # from scraping a non-reproducible web address.
>>> saveRDS(rawData, file = "rawData.rds")
>> Then copy to a Linux session
>>
>>> rawData <- readRDS(file = "rawData.rds")
>>> rawData
>> [1] "rawData"
>>> object.size(rawData)
>> 112 bytes
>>> rawData
>> [1] "rawData" # only the name and something to make up 112 bytes
>> Have I misunderstood the syntax?
>>
>> It's an old version on Windows.  I haven't used Windows R since then.
>>
>> major          3
>> minor          2.4
>> year           2016
>> month          03
>> day            16
>>
>>
>> I've tried R-3.5.0 and R-3.5.1 Linux versions.
>>
>> In case it's material ...
>>
>> I couldn't get the scraping to work on either of the R installations
>> but Windows users told me it worked for them.  So I thought I'd get
>> the R object and use it.  I could understand accessing the web address
>> could have different permissions for different OSes, but should that
>> affect the R objects?
>>
>> TIA
>>
>> --
>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>>     ___    Patrick Connolly
>>   {~._.~}                   Great minds discuss ideas
>>   _( Y )_                 Average minds discuss events
>> (:_~*~_:)                  Small minds discuss people
>>   (_)-(_)                              ..... Eleanor Roosevelt
>>
>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>>
>> ______________________________________________
>> [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.

______________________________________________
[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: saveRDS() and readRDS() Why?

Patrick Connolly-4
In reply to this post by Eric Berger
They're both about 3kb.

On 7/11/18 9:13 PM, Eric Berger wrote:

> What do you see at the OS level?
> i.e. on windows
> DIR rawData.rds
> on linux
> ls -l rawData.rds
> compare the file sizes on both.
>
>
> On Wed, Nov 7, 2018 at 9:56 AM Patrick Connolly
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     From a Windows R session, I do
>
>     > object.size(rawData)
>     31736 bytes  # from scraping a non-reproducible web address.
>     > saveRDS(rawData, file = "rawData.rds")
>
>     Then copy to a Linux session
>
>     > rawData <- readRDS(file = "rawData.rds")
>     > rawData
>     [1] "rawData"
>     > object.size(rawData)
>     112 bytes
>     > rawData
>     [1] "rawData" # only the name and something to make up 112 bytes
>     >
>
>     Have I misunderstood the syntax?
>
>     It's an old version on Windows.  I haven't used Windows R since then.
>
>     major          3
>     minor          2.4
>     year           2016
>     month          03
>     day            16
>
>
>     I've tried R-3.5.0 and R-3.5.1 Linux versions.
>
>     In case it's material ...
>
>     I couldn't get the scraping to work on either of the R installations
>     but Windows users told me it worked for them.  So I thought I'd get
>     the R object and use it.  I could understand accessing the web address
>     could have different permissions for different OSes, but should that
>     affect the R objects?
>
>     TIA
>
>     --
>     ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>
>        ___    Patrick Connolly
>      {~._.~}                   Great minds discuss ideas
>      _( Y )_                 Average minds discuss events
>     (:_~*~_:)                  Small minds discuss people
>      (_)-(_)                              ..... Eleanor Roosevelt
>
>     ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>
>     ______________________________________________
>     [hidden email] <mailto:[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: saveRDS() and readRDS() Why?

Patrick Connolly-4
In reply to this post by R help mailing list-2
On Wed, 07-Nov-2018 at 08:27AM +0000, Robert David Burbidge wrote:

|> Hi Patrick,
|>
|> From the help: "save writes a single line header (typically
|> "RDXs\n") before the serialization of a single object".
|>
|> If the file sizes are the same (see Eric's message), then the
|> problem may be due to different line terminators. Try serialize and
|> unserialize for low-level control of saving/reading objects.

I'll have to find out what 'serialize' means.

On Windows, it's a huge table, looks like it's all hexadecimal.  

On Linux, it's just the text string 'rawData' -- a lot more than line
terminators.

Have I misunderstood what the idea is?  I thought I'd get an identical
object, irrespective of how different the OS stores and zips it.



|>
|> Rgds,
|>
|> Robert
|>
|>
|> On 07/11/18 08:13, Eric Berger wrote:
|> >What do you see at the OS level?
|> >i.e. on windows
|> >DIR rawData.rds
|> >on linux
|> >ls -l rawData.rds
|> >compare the file sizes on both.
|> >
|> >
|> >On Wed, Nov 7, 2018 at 9:56 AM Patrick Connolly <[hidden email]>
|> >wrote:
|> >
|> >> From a Windows R session, I do
|> >>
|> >>>object.size(rawData)
|> >>31736 bytes  # from scraping a non-reproducible web address.
|> >>>saveRDS(rawData, file = "rawData.rds")
|> >>Then copy to a Linux session
|> >>
|> >>>rawData <- readRDS(file = "rawData.rds")
|> >>>rawData
|> >>[1] "rawData"
|> >>>object.size(rawData)
|> >>112 bytes
|> >>>rawData
|> >>[1] "rawData" # only the name and something to make up 112 bytes
|> >>Have I misunderstood the syntax?
|> >>
|> >>It's an old version on Windows.  I haven't used Windows R since then.
|> >>
|> >>major          3
|> >>minor          2.4
|> >>year           2016
|> >>month          03
|> >>day            16
|> >>
|> >>
|> >>I've tried R-3.5.0 and R-3.5.1 Linux versions.
|> >>
|> >>In case it's material ...
|> >>
|> >>I couldn't get the scraping to work on either of the R installations
|> >>but Windows users told me it worked for them.  So I thought I'd get
|> >>the R object and use it.  I could understand accessing the web address
|> >>could have different permissions for different OSes, but should that
|> >>affect the R objects?
|> >>
|> >>TIA
|> >>
|> >>--
|> >>~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
|> >>    ___    Patrick Connolly
|> >>  {~._.~}                   Great minds discuss ideas
|> >>  _( Y )_                 Average minds discuss events
|> >>(:_~*~_:)                  Small minds discuss people
|> >>  (_)-(_)                              ..... Eleanor Roosevelt
|> >>
|> >>~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
|> >>
|> >>______________________________________________
|> >>[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.

--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.  
   ___    Patrick Connolly  
 {~._.~}                   Great minds discuss ideas    
 _( Y )_           Average minds discuss events
(:_~*~_:)                  Small minds discuss people  
 (_)-(_)                        ..... Eleanor Roosevelt
         
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

______________________________________________
[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: saveRDS() and readRDS() Why?

Eric Berger
Your understanding is correct. It works fine for me.

On Wed, Nov 7, 2018 at 10:48 AM Patrick Connolly <[hidden email]>
wrote:

> On Wed, 07-Nov-2018 at 08:27AM +0000, Robert David Burbidge wrote:
>
> |> Hi Patrick,
> |>
> |> From the help: "save writes a single line header (typically
> |> "RDXs\n") before the serialization of a single object".
> |>
> |> If the file sizes are the same (see Eric's message), then the
> |> problem may be due to different line terminators. Try serialize and
> |> unserialize for low-level control of saving/reading objects.
>
> I'll have to find out what 'serialize' means.
>
> On Windows, it's a huge table, looks like it's all hexadecimal.
>
> On Linux, it's just the text string 'rawData' -- a lot more than line
> terminators.
>
> Have I misunderstood what the idea is?  I thought I'd get an identical
> object, irrespective of how different the OS stores and zips it.
>
>
>
> |>
> |> Rgds,
> |>
> |> Robert
> |>
> |>
> |> On 07/11/18 08:13, Eric Berger wrote:
> |> >What do you see at the OS level?
> |> >i.e. on windows
> |> >DIR rawData.rds
> |> >on linux
> |> >ls -l rawData.rds
> |> >compare the file sizes on both.
> |> >
> |> >
> |> >On Wed, Nov 7, 2018 at 9:56 AM Patrick Connolly <
> [hidden email]>
> |> >wrote:
> |> >
> |> >> From a Windows R session, I do
> |> >>
> |> >>>object.size(rawData)
> |> >>31736 bytes  # from scraping a non-reproducible web address.
> |> >>>saveRDS(rawData, file = "rawData.rds")
> |> >>Then copy to a Linux session
> |> >>
> |> >>>rawData <- readRDS(file = "rawData.rds")
> |> >>>rawData
> |> >>[1] "rawData"
> |> >>>object.size(rawData)
> |> >>112 bytes
> |> >>>rawData
> |> >>[1] "rawData" # only the name and something to make up 112 bytes
> |> >>Have I misunderstood the syntax?
> |> >>
> |> >>It's an old version on Windows.  I haven't used Windows R since then.
> |> >>
> |> >>major          3
> |> >>minor          2.4
> |> >>year           2016
> |> >>month          03
> |> >>day            16
> |> >>
> |> >>
> |> >>I've tried R-3.5.0 and R-3.5.1 Linux versions.
> |> >>
> |> >>In case it's material ...
> |> >>
> |> >>I couldn't get the scraping to work on either of the R installations
> |> >>but Windows users told me it worked for them.  So I thought I'd get
> |> >>the R object and use it.  I could understand accessing the web address
> |> >>could have different permissions for different OSes, but should that
> |> >>affect the R objects?
> |> >>
> |> >>TIA
> |> >>
> |> >>--
> |>
> >>~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> |> >>    ___    Patrick Connolly
> |> >>  {~._.~}                   Great minds discuss ideas
> |> >>  _( Y )_                 Average minds discuss events
> |> >>(:_~*~_:)                  Small minds discuss people
> |> >>  (_)-(_)                              ..... Eleanor Roosevelt
> |> >>
> |>
> >>~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> |> >>
> |> >>______________________________________________
> |> >>[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.
>
> --
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>    ___    Patrick Connolly
>  {~._.~}                   Great minds discuss ideas
>  _( Y )_                 Average minds discuss events
> (:_~*~_:)                  Small minds discuss people
>  (_)-(_)                              ..... Eleanor Roosevelt
>
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>
> ______________________________________________
> [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: saveRDS() and readRDS() Why?

R help mailing list-2
In reply to this post by Patrick Connolly-4
If the file sizes are the same, then presumably both contain the binary data. From the serialize function help:

"As almost all systems in current use are little-endian, xdr = FALSE can be used to avoid byte-shuffling at both ends when transferring data from one little-endian machine to another (or between processes on the same machine). Depending on the system, this can speed up serialization and unserialization by a factor of up to 3x."

So you could try:

# windows (not run)
f <- file("rawData.rds", open="w")
serialize(rawData, f, xdr = FALSE)
close(f)

# linux
rawData <- unserialize(file = "rawData.rds")

HTH

On 07/11/18 08:45, Patrick Connolly wrote:

> On Wed, 07-Nov-2018 at 08:27AM +0000, Robert David Burbidge wrote:
>
> |> Hi Patrick,
> |>
> |> From the help: "save writes a single line header (typically
> |> "RDXs\n") before the serialization of a single object".
> |>
> |> If the file sizes are the same (see Eric's message), then the
> |> problem may be due to different line terminators. Try serialize and
> |> unserialize for low-level control of saving/reading objects.
>
> I'll have to find out what 'serialize' means.
>
> On Windows, it's a huge table, looks like it's all hexadecimal.
>
> On Linux, it's just the text string 'rawData' -- a lot more than line
> terminators.
>
> Have I misunderstood what the idea is?  I thought I'd get an identical
> object, irrespective of how different the OS stores and zips it.
>
>
>
> |>
> |> Rgds,
> |>
> |> Robert
> |>
> |>
> |> On 07/11/18 08:13, Eric Berger wrote:
> |> >What do you see at the OS level?
> |> >i.e. on windows
> |> >DIR rawData.rds
> |> >on linux
> |> >ls -l rawData.rds
> |> >compare the file sizes on both.
> |> >
> |> >
> |> >On Wed, Nov 7, 2018 at 9:56 AM Patrick Connolly <[hidden email]>
> |> >wrote:
> |> >
> |> >> From a Windows R session, I do
> |> >>
> |> >>>object.size(rawData)
> |> >>31736 bytes  # from scraping a non-reproducible web address.
> |> >>>saveRDS(rawData, file = "rawData.rds")
> |> >>Then copy to a Linux session
> |> >>
> |> >>>rawData <- readRDS(file = "rawData.rds")
> |> >>>rawData
> |> >>[1] "rawData"
> |> >>>object.size(rawData)
> |> >>112 bytes
> |> >>>rawData
> |> >>[1] "rawData" # only the name and something to make up 112 bytes
> |> >>Have I misunderstood the syntax?
> |> >>
> |> >>It's an old version on Windows.  I haven't used Windows R since then.
> |> >>
> |> >>major          3
> |> >>minor          2.4
> |> >>year           2016
> |> >>month          03
> |> >>day            16
> |> >>
> |> >>
> |> >>I've tried R-3.5.0 and R-3.5.1 Linux versions.
> |> >>
> |> >>In case it's material ...
> |> >>
> |> >>I couldn't get the scraping to work on either of the R installations
> |> >>but Windows users told me it worked for them.  So I thought I'd get
> |> >>the R object and use it.  I could understand accessing the web address
> |> >>could have different permissions for different OSes, but should that
> |> >>affect the R objects?
> |> >>
> |> >>TIA
> |> >>
> |> >>-
>

______________________________________________
[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: saveRDS() and readRDS() Why?

Jan van der LAan-2
In reply to this post by Patrick Connolly-4

Are you sure you didn't do saveRDS("rawData", file = "rawData.rds")
instead of saveRDS(rawData, file = "rawData.rds") ? This would explain
the result you have under linux.

In principle saveRDS and readRDS can be used to copy objects between
R-sessions without loosing information.

What does readRDS return on windows with the same file?

What type of object is rawData? Do str(rawData). Some objects created by
packages cannot be serialized, e.g. objects that point to memory
allocated by a package. The pointer is then serialized not the memory
pointed to.

Also, if the object is generated by a package, you might need to load
the package to get the printing etc. of the object right.

HTH,

Jan







On 07-11-18 09:45, Patrick Connolly wrote:

> On Wed, 07-Nov-2018 at 08:27AM +0000, Robert David Burbidge wrote:
>
> |> Hi Patrick,
> |>
> |> From the help: "save writes a single line header (typically
> |> "RDXs\n") before the serialization of a single object".
> |>
> |> If the file sizes are the same (see Eric's message), then the
> |> problem may be due to different line terminators. Try serialize and
> |> unserialize for low-level control of saving/reading objects.
>
> I'll have to find out what 'serialize' means.
>
> On Windows, it's a huge table, looks like it's all hexadecimal.
>
> On Linux, it's just the text string 'rawData' -- a lot more than line
> terminators.
>
> Have I misunderstood what the idea is?  I thought I'd get an identical
> object, irrespective of how different the OS stores and zips it.
>
>
>
> |>
> |> Rgds,
> |>
> |> Robert
> |>
> |>
> |> On 07/11/18 08:13, Eric Berger wrote:
> |> >What do you see at the OS level?
> |> >i.e. on windows
> |> >DIR rawData.rds
> |> >on linux
> |> >ls -l rawData.rds
> |> >compare the file sizes on both.
> |> >
> |> >
> |> >On Wed, Nov 7, 2018 at 9:56 AM Patrick Connolly <[hidden email]>
> |> >wrote:
> |> >
> |> >> From a Windows R session, I do
> |> >>
> |> >>>object.size(rawData)
> |> >>31736 bytes  # from scraping a non-reproducible web address.
> |> >>>saveRDS(rawData, file = "rawData.rds")
> |> >>Then copy to a Linux session
> |> >>
> |> >>>rawData <- readRDS(file = "rawData.rds")
> |> >>>rawData
> |> >>[1] "rawData"
> |> >>>object.size(rawData)
> |> >>112 bytes
> |> >>>rawData
> |> >>[1] "rawData" # only the name and something to make up 112 bytes
> |> >>Have I misunderstood the syntax?
> |> >>
> |> >>It's an old version on Windows.  I haven't used Windows R since then.
> |> >>
> |> >>major          3
> |> >>minor          2.4
> |> >>year           2016
> |> >>month          03
> |> >>day            16
> |> >>
> |> >>
> |> >>I've tried R-3.5.0 and R-3.5.1 Linux versions.
> |> >>
> |> >>In case it's material ...
> |> >>
> |> >>I couldn't get the scraping to work on either of the R installations
> |> >>but Windows users told me it worked for them.  So I thought I'd get
> |> >>the R object and use it.  I could understand accessing the web address
> |> >>could have different permissions for different OSes, but should that
> |> >>affect the R objects?
> |> >>
> |> >>TIA
> |> >>
> |> >>--
> |> >>~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> |> >>    ___    Patrick Connolly
> |> >>  {~._.~}                   Great minds discuss ideas
> |> >>  _( Y )_                 Average minds discuss events
> |> >>(:_~*~_:)                  Small minds discuss people
> |> >>  (_)-(_)                              ..... Eleanor Roosevelt
> |> >>
> |> >>~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> |> >>
> |> >>______________________________________________
> |> >>[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.
>

______________________________________________
[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: saveRDS() and readRDS() Why?

R help mailing list-2
In reply to this post by Patrick Connolly-4
Patrick,

I cannot reproduce this behaviour. I'm using:

Windows 8.1; R 3.5.1; RStudio 1.1.463

running in a VirtualBox on Ubuntu 18.04 with R 3.4.4; RStudio 1.1.456

The file size of rawData.rds is always 88 bytes in my example and od
gives the same results on Windows and Linux.

I am using a VirtualBox shared folder to transfer from Windows to Linux.

Could you provide details of your machines?

Rgds,

Robert


On 07/11/18 07:56, Patrick Connolly wrote:

>  From a Windows R session, I do
>  
>> object.size(rawData)
> 31736 bytes  # from scraping a non-reproducible web address.
>> saveRDS(rawData, file = "rawData.rds")
> Then copy to a Linux session
>
>> rawData <- readRDS(file = "rawData.rds")
>> rawData
> [1] "rawData"
>> object.size(rawData)
> 112 bytes
>> rawData
> [1] "rawData" # only the name and something to make up 112 bytes
> Have I misunderstood the syntax?
>
> It's an old version on Windows.  I haven't used Windows R since then.
>
> major          3
> minor          2.4
> year           2016
> month          03
> day            16
>
>
> I've tried R-3.5.0 and R-3.5.1 Linux versions.
>
> In case it's material ...
>
> I couldn't get the scraping to work on either of the R installations
> but Windows users told me it worked for them.  So I thought I'd get
> the R object and use it.  I could understand accessing the web address
> could have different permissions for different OSes, but should that
> affect the R objects?
>
> TIA
>

______________________________________________
[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: saveRDS() and readRDS() Why? [solved, kind of]

Patrick Connolly-4
In reply to this post by Patrick Connolly-4

Many thanks to Berwin, Eric, Robert, and Jan for their input.

I had hoped it was as simple as because I typed

saveRDS("rawData", file = "rawData.rds") on the Windows side.
but that wasn't the case.

Robert Burbridge suggested:

 windows (not run)
f <- file("rawData.rds", open="w")
serialize(rawData, f, xdr = FALSE)
close(f)

# linux
rawData <- unserialize(file = "rawData.rds")

That didn't work:
Error in unserialize(file = "rawData.rds") :
  unused argument (file = "rawData.rds")
(the argument isn't 'file')

Nor did
> rawData <- unserialize("rawData.rds")
Error in unserialize("rawData.rds") :
  character vectors are no longer accepted by unserialize()

However

readRDS(file = "rawData.rds") did!

So what I needed was serialize but not unserialize.

I still don't know Why, but I know How.
--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.  
   ___    Patrick Connolly  
 {~._.~}                   Great minds discuss ideas    
 _( Y )_           Average minds discuss events
(:_~*~_:)                  Small minds discuss people  
 (_)-(_)                        ..... Eleanor Roosevelt
         
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

______________________________________________
[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: saveRDS() and readRDS() Why? [solved, kind of]

Martin Maechler
>>>>> Patrick Connolly
>>>>>     on Thu, 8 Nov 2018 20:27:24 +1300 writes:

> Many thanks to Berwin, Eric, Robert, and Jan for their input.
>
> I had hoped it was as simple as because I typed
>
> saveRDS("rawData", file = "rawData.rds") on the Windows side.

> but that wasn't the case.
>
> Robert Burbridge suggested:
>
>  windows (not run)
> f <- file("rawData.rds", open="w")
> serialize(rawData, f, xdr = FALSE)
> close(f)
>
> # linux
> rawData <- unserialize(file = "rawData.rds")
>
> That didn't work:
> Error in unserialize(file = "rawData.rds") :
>   unused argument (file = "rawData.rds")
> (the argument isn't 'file')
>
> Nor did
> > rawData <- unserialize("rawData.rds")
> Error in unserialize("rawData.rds") :
>   character vectors are no longer accepted by unserialize()
>
> However
>
> readRDS(file = "rawData.rds") did!
>
> So what I needed was serialize but not unserialize.
>
> I still don't know Why, but I know How.

Hmm.. and nobody has been able to reproduce your problem, right?

IIUC, currently you are suggesting that [on Windows], if you do

      saveRDS(rawdata, file="rawdata.rds")

the resulting file is does not work with    readRDS()  on Linux.
What again are your R versions on the two platforms?

Could you  dput() -- provide a (short if possible) version of rawdata where
that problem occurs ?

Best,
Martin


> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.  
>    ___    Patrick Connolly  
>  {~._.~}                   Great minds discuss ideas    
>  _( Y )_           Average minds discuss events
> (:_~*~_:)                  Small minds discuss people  
>  (_)-(_)                        ..... Eleanor Roosevelt
>  
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>
> ______________________________________________
> [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.

______________________________________________
[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: saveRDS() and readRDS() Why? [solved, kind of]

R help mailing list-2
In reply to this post by Patrick Connolly-4
Apologies, unserialize takes a connection, not a file, so you would need
something like:

# linux (not run)
f <- file("rawData.rds", open="r")
rawData <- unserialize(f)
close(f)

The help file states that readRDS will read a file created by serialize
(saveRDS is a wrapper for serialize).

It appears that the problem was "byte-shuffling at both ends when
transferring data from one little-endian machine to another" and was
worked around by using xdr = FALSE. So, this wouldn't necessarily work
when transferring between big-endian and little-endian machines.

On 08/11/18 07:27, Patrick Connolly wrote:

> Many thanks to Berwin, Eric, Robert, and Jan for their input.
>
> I had hoped it was as simple as because I typed
>
> saveRDS("rawData", file = "rawData.rds") on the Windows side.
> but that wasn't the case.
>
> Robert Burbridge suggested:
>
>   windows (not run)
> f <- file("rawData.rds", open="w")
> serialize(rawData, f, xdr = FALSE)
> close(f)
>
> # linux
> rawData <- unserialize(file = "rawData.rds")
>
> That didn't work:
> Error in unserialize(file = "rawData.rds") :
>    unused argument (file = "rawData.rds")
> (the argument isn't 'file')
>
> Nor did
>> rawData <- unserialize("rawData.rds")
> Error in unserialize("rawData.rds") :
>    character vectors are no longer accepted by unserialize()
>
> However
>
> readRDS(file = "rawData.rds") did!
>
> So what I needed was serialize but not unserialize.
>
> I still don't know Why, but I know How.

______________________________________________
[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: saveRDS() and readRDS() Why? [solved, kind of]

Patrick Connolly-4
In reply to this post by Martin Maechler
On Thu, 08-Nov-2018 at 11:06AM +0100, Martin Maechler wrote:

|> >>>>> Patrick Connolly
|> >>>>>     on Thu, 8 Nov 2018 20:27:24 +1300 writes:

[...]

|> >
|> > I still don't know Why, but I know How.
|>
|> Hmm.. and nobody has been able to reproduce your problem, right?
|>
|> IIUC, currently you are suggesting that [on Windows], if you do
|>
|>       saveRDS(rawdata, file="rawdata.rds")
|>
|> the resulting file is does not work with    readRDS()  on Linux.
|> What again are your R versions on the two platforms?


It's an old version on Windows.  I haven't used Windows R since then.

major          3                                          
minor          2.4                                        
year           2016                                      
month          03                                        
day            16                                        


I've tried R-3.5.0 and R-3.5.1 Linux versions.  The problem might be
entirely because of the ancient Windows version.


|>
|> Could you  dput() -- provide a (short if possible) version of rawdata where
|> that problem occurs ?

I can't make a smaller version of rawdata which comes from scraping a
non-public web address, but next week when I'm back where those
machines are, I'll try it with a small data frame which is
reproducible.



|>
|> Best,
|> Martin
|>
|>
|> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.  
|> >    ___    Patrick Connolly  
|> >  {~._.~}                   Great minds discuss ideas    
|> >  _( Y )_           Average minds discuss events
|> > (:_~*~_:)                  Small minds discuss people  
|> >  (_)-(_)                        ..... Eleanor Roosevelt
|> >  
|> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
|> >
|> > ______________________________________________
|> > [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.

--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.  
   ___    Patrick Connolly  
 {~._.~}                   Great minds discuss ideas    
 _( Y )_           Average minds discuss events
(:_~*~_:)                  Small minds discuss people  
 (_)-(_)                        ..... Eleanor Roosevelt
         
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

______________________________________________
[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: saveRDS() and readRDS() Why? [solved, pretty much anyway)

Patrick Connolly-4
The solution was very simple.  Don't use the same name for the rds
file  as used for the R object, viz a vie:

saveRDS(x, file = "x.rds")
and
x <- readRDS(file = "x.rds")

will not work; however

saveRDS(x, file = "y.rds")
and
x <- readRDS(file = "y.rds")
will work.

An undocumented feature?

Thanks to all who contributed.



On Sat, 10-Nov-2018 at 08:48PM +1300, Patrick Connolly wrote:

|> On Thu, 08-Nov-2018 at 11:06AM +0100, Martin Maechler wrote:
|>
|> |> >>>>> Patrick Connolly
|> |> >>>>>     on Thu, 8 Nov 2018 20:27:24 +1300 writes:
|>
|> [...]
|>
|> |> >
|> |> > I still don't know Why, but I know How.
|> |>
|> |> Hmm.. and nobody has been able to reproduce your problem, right?
|> |>
|> |> IIUC, currently you are suggesting that [on Windows], if you do
|> |>
|> |>       saveRDS(rawdata, file="rawdata.rds")
|> |>
|> |> the resulting file is does not work with    readRDS()  on Linux.
|> |> What again are your R versions on the two platforms?
|>
|>
|> It's an old version on Windows.  I haven't used Windows R since then.
|>
|> major          3                                          
|> minor          2.4                                        
|> year           2016                                      
|> month          03                                        
|> day            16                                        
|>
|>
|> I've tried R-3.5.0 and R-3.5.1 Linux versions.  The problem might be
|> entirely because of the ancient Windows version.
|>
|>
|> |>
|> |> Could you  dput() -- provide a (short if possible) version of rawdata where
|> |> that problem occurs ?
|>
|> I can't make a smaller version of rawdata which comes from scraping a
|> non-public web address, but next week when I'm back where those
|> machines are, I'll try it with a small data frame which is
|> reproducible.
|>
|>
|>
|> |>
|> |> Best,
|> |> Martin
|> |>
|> |>
|> |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.  
|> |> >    ___    Patrick Connolly  
|> |> >  {~._.~}                   Great minds discuss ideas    
|> |> >  _( Y )_           Average minds discuss events
|> |> > (:_~*~_:)                  Small minds discuss people  
|> |> >  (_)-(_)                        ..... Eleanor Roosevelt
|> |> >  
|> |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
|> |> >
|> |> > ______________________________________________
|> |> > [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.
|>
|> --
|> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.  
|>    ___    Patrick Connolly  
|>  {~._.~}                   Great minds discuss ideas    
|>  _( Y )_           Average minds discuss events
|> (:_~*~_:)                  Small minds discuss people  
|>  (_)-(_)                        ..... Eleanor Roosevelt
|>  
|> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
|>
|> ______________________________________________
|> [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.

--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.  
   ___    Patrick Connolly  
 {~._.~}                   Great minds discuss ideas    
 _( Y )_           Average minds discuss events
(:_~*~_:)                  Small minds discuss people  
 (_)-(_)                        ..... Eleanor Roosevelt
         
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

______________________________________________
[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: saveRDS() and readRDS() Why? [solved, pretty much anyway)

Patrick Connolly-4
On 2018-11-12 22:49, peter dalgaard wrote:

> Er, where, what, how? I can't reproduce that, at least not on 3.5.1 on
> MacOS:
>
>> x <- airquality
>> saveRDS(x, file = "x.rds")
>> x <- NULL
>> x <- readRDS(file = "x.rds")
>> x
>     Ozone Solar.R Wind Temp Month Day
> 1      41     190  7.4   67     5   1
> 2      36     118  8.0   72     5   2
> 3      12     149 12.6   74     5   3
> ...
>
> Looks fine to me.
>

It seems to work fine using the same installation to read as used for
the save.
But it's a different story if the save was done on a Windows
installation and read on a Linux installation.

## On Windows 3.4.2
> x <- airquality
> saveRDS(x, file = "x.rds")
> saveRDS(x, file = "y.rds")

Files x.rds and y.rds are identical in size but utterly different in
content.

## On Linux 3.5.1

> x <- readRDS(file =  "x.rds")
Error in readRDS(file = "x.rds") : error reading from connection
> x <- readRDS(file =  "y.rds")
> head(x)
   Ozone Solar.R Wind Temp Month Day
1    41     190  7.4   67     5   1
2    36     118  8.0   72     5   2
3    12     149 12.6   74     5   3
4    18     313 11.5   62     5   4
5    NA      NA 14.3   56     5   5
6    28      NA 14.9   66     5   6

It might just be the age of the Windows installation.  I don't have much
use for Windows, so I haven't had much inclination to install a newer
version.

YMMV



> ?
> -pd
>
>
>> On 12 Nov 2018, at 08:28 , Patrick Connolly
>> <[hidden email]> wrote:
>>
>> The solution was very simple.  Don't use the same name for the rds
>> file  as used for the R object, viz a vie:
>>
>> saveRDS(x, file = "x.rds")
>> and
>> x <- readRDS(file = "x.rds")
>>
>> will not work; however
>>
>> saveRDS(x, file = "y.rds")
>> and
>> x <- readRDS(file = "y.rds")
>> will work.
>>
>> An undocumented feature?
>>
>> Thanks to all who contributed.
>
> --
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Office: A 4.23
> Email: [hidden email]  Priv: [hidden email]

______________________________________________
[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: saveRDS() and readRDS() Why? [solved, pretty much anyway)

R help mailing list-2
You wrote:
  ## On Windows 3.4.2

>   x <- airquality
>   saveRDS(x, file = "x.rds")
>   saveRDS(x, file = "y.rds")
>

  Files x.rds and y.rds are identical in size but utterly different in
content.

Wow!  Can you show us the results of
  x <- datasets::airquality
  saveRDS(x, file="x.rds")
  saveRDS(x, file="y.rds")
  tools::md5sum(c("x.rds", "y.rds"))
  dput(readBin("x.rds", what="raw", n=file.size("x.rds")))
  dput(readBin("y.rds", what="raw", n=file.size("y.rds")))

(Copy and paste, as text, from the R session, so we can see the input and
the output in context.





Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Mon, Nov 12, 2018 at 12:42 PM, p_connolly <[hidden email]>
wrote:

> On 2018-11-12 22:49, peter dalgaard wrote:
>
>> Er, where, what, how? I can't reproduce that, at least not on 3.5.1 on
>> MacOS:
>>
>> x <- airquality
>>> saveRDS(x, file = "x.rds")
>>> x <- NULL
>>> x <- readRDS(file = "x.rds")
>>> x
>>>
>>     Ozone Solar.R Wind Temp Month Day
>> 1      41     190  7.4   67     5   1
>> 2      36     118  8.0   72     5   2
>> 3      12     149 12.6   74     5   3
>> ...
>>
>> Looks fine to me.
>>
>>
> It seems to work fine using the same installation to read as used for the
> save.
> But it's a different story if the save was done on a Windows installation
> and read on a Linux installation.
>
> ## On Windows 3.4.2
>
>> x <- airquality
>> saveRDS(x, file = "x.rds")
>> saveRDS(x, file = "y.rds")
>>
>
> Files x.rds and y.rds are identical in size but utterly different in
> content.
>
> ## On Linux 3.5.1
>
> x <- readRDS(file =  "x.rds")
>>
> Error in readRDS(file = "x.rds") : error reading from connection
>
>> x <- readRDS(file =  "y.rds")
>> head(x)
>>
>   Ozone Solar.R Wind Temp Month Day
> 1    41     190  7.4   67     5   1
> 2    36     118  8.0   72     5   2
> 3    12     149 12.6   74     5   3
> 4    18     313 11.5   62     5   4
> 5    NA      NA 14.3   56     5   5
> 6    28      NA 14.9   66     5   6
>
> It might just be the age of the Windows installation.  I don't have much
> use for Windows, so I haven't had much inclination to install a newer
> version.
>
> YMMV
>
>
>
> ?
>> -pd
>>
>>
>> On 12 Nov 2018, at 08:28 , Patrick Connolly <[hidden email]>
>>> wrote:
>>>
>>> The solution was very simple.  Don't use the same name for the rds
>>> file  as used for the R object, viz a vie:
>>>
>>> saveRDS(x, file = "x.rds")
>>> and
>>> x <- readRDS(file = "x.rds")
>>>
>>> will not work; however
>>>
>>> saveRDS(x, file = "y.rds")
>>> and
>>> x <- readRDS(file = "y.rds")
>>> will work.
>>>
>>> An undocumented feature?
>>>
>>> Thanks to all who contributed.
>>>
>>
>> --
>> Peter Dalgaard, Professor,
>> Center for Statistics, Copenhagen Business School
>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>> Phone: (+45)38153501
>> Office: A 4.23
>> Email: [hidden email]  Priv: [hidden email]
>>
>
> ______________________________________________
> [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/posti
> ng-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: saveRDS() and readRDS() Why? [solved, pretty much anyway)

Patrick Connolly-4
On 2018-11-13 12:55, William Dunlap wrote:

> You wrote:
>   ## On Windows 3.4.2
>
>> x <- airquality
>> saveRDS(x, file = "x.rds")
>> saveRDS(x, file = "y.rds")
>
>   Files x.rds and y.rds are identical in size but utterly different in
> content.
>
>  Wow!  Can you show us the results of
>   x <- datasets::airquality
>   saveRDS(x, file="x.rds")
>   saveRDS(x, file="y.rds")
>   tools::md5sum(c("x.rds", "y.rds"))
>   dput(readBin("x.rds", what="raw", n=file.size("x.rds")))
>   dput(readBin("y.rds", what="raw", n=file.size("y.rds")))
>
> (Copy and paste, as text, from the R session, so we can see the input
> and the output in context.

If I do that on Linux or Windows, I get identical files.

If I copy x.rds and y.rds from Windows to Linux (which is what I wish to
be able to do) using a shared folder between the Windows VirtualBox host
to the Linux guest, I  get this:


> x <- readRDS(file =  "x.rds")
Error in readRDS(file = "x.rds") : error reading from connection
> x <- readRDS(file =  "y.rds")
>   tools::md5sum(c("x.rds", "y.rds"))
                              x.rds                              y.rds
"5fef054848f39b4be02b7c54f1c71a20" "978a64d1dd342d16a381c9ca728d3665"
>   dput(readBin("x.rds", what="raw", n=file.size("x.rds")))
as.raw(c(0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00))
>   dput(readBin("y.rds", what="raw", n=file.size("y.rds")))
as.raw(c(0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0xe5, 0x97, 0x4b, 0x6c, 0x54, 0x55, 0x18, 0xc7, 0xcf, 0x9d,
0x0e, 0x7d, 0x41, 0x71, 0x2c, 0x15, 0xac, 0x65, 0xa0, 0x94, 0xa9,
0x80, 0x94, 0x52, 0xa1, 0x0b, 0xa9, 0x01, 0xa6, 0x58, 0xc4, 0xda,
0x76, 0x68, 0x99, 0x42, 0x0b, 0x2d, 0xe8, 0x08, 0x45, 0x4d, 0xca,
0x94, 0xb4, 0xc4, 0x07, 0x1b, 0x49, 0x5c, 0x10, 0x75, 0x65, 0xa2,
0x26, 0x35, 0x71, 0xad, 0x3b, 0x16, 0x2e, 0x4c, 0x7c, 0x6b, 0xc2,
0x82, 0xa8, 0x71, 0xa3, 0x71, 0x63, 0x7c, 0x2c, 0x74, 0x85, 0x2c,
0x8c, 0x0b, 0xa3, 0x40, 0xfd, 0x7f, 0xf7, 0xfc, 0xff, 0xed, 0xcd,
0x49, 0x59, 0xcf, 0xc2, 0x9b, 0xfc, 0xe6, 0xbb, 0xe7, 0x3b, 0xe7,
0x7c, 0xaf, 0x73, 0xee, 0xdc, 0x73, 0xc7, 0xeb, 0x9d, 0x73, 0x29,
0x57, 0x95, 0x4a, 0xbb, 0x54, 0x15, 0x6e, 0xab,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, 0x5d, 0x28,
0x75, 0x9e, 0x9d, 0x45, 0x0c, 0xc1, 0xf0, 0xba, 0xd9, 0x99, 0xe7,
0x3b, 0x15, 0x9b, 0x25, 0x9e, 0xba, 0x84, 0x9f, 0x85, 0x85, 0x85,
0xa7, 0x21, 0x6e, 0xff, 0x07, 0x03, 0xf3, 0xcf, 0x7e, 0xc7, 0x11,
0x00, 0x00))
>

The issue is evidently with the shared folder. I've been doing that
(sharing the folder) for years and never encountered a problem.


>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com [1]
> On Mon, Nov 12, 2018 at 12:42 PM, p_connolly
> <[hidden email]> wrote:
>
>> On 2018-11-12 22:49, peter dalgaard wrote:
>> Er, where, what, how? I can't reproduce that, at least not on 3.5.1
>> on MacOS:
>>
>> x <- airquality
>> saveRDS(x, file = "x.rds")
>> x <- NULL
>> x <- readRDS(file = "x.rds")
>> x
>> Ozone Solar.R Wind Temp Month Day
>> 1      41     190  7.4   67     5   1
>> 2      36     118  8.0   72     5   2
>> 3      12     149 12.6   74     5   3
>> ...
>>
>> Looks fine to me.
>
> It seems to work fine using the same installation to read as used for
> the save.
> But it's a different story if the save was done on a Windows
> installation and read on a Linux installation.
>
> ## On Windows 3.4.2
>
>> x <- airquality
>> saveRDS(x, file = "x.rds")
>> saveRDS(x, file = "y.rds")
>
> Files x.rds and y.rds are identical in size but utterly different in
> content.
>
> ## On Linux 3.5.1
>
>> x <- readRDS(file =  "x.rds")
>  Error in readRDS(file = "x.rds") : error reading from connection
>
>> x <- readRDS(file =  "y.rds")
>> head(x)
>    Ozone Solar.R Wind Temp Month Day
> 1    41     190  7.4   67     5   1
> 2    36     118  8.0   72     5   2
> 3    12     149 12.6   74     5   3
> 4    18     313 11.5   62     5   4
> 5    NA      NA 14.3   56     5   5
> 6    28      NA 14.9   66     5   6
>
> It might just be the age of the Windows installation.  I don't have
> much use for Windows, so I haven't had much inclination to install a
> newer version.
>
> YMMV
>
>> ?
>> -pd
>>
>>> On 12 Nov 2018, at 08:28 , Patrick Connolly
>>> <[hidden email]> wrote:
>>>
>>> The solution was very simple.  Don't use the same name for the rds
>>> file  as used for the R object, viz a vie:
>>>
>>> saveRDS(x, file = "x.rds")
>>> and
>>> x <- readRDS(file = "x.rds")
>>>
>>> will not work; however
>>>
>>> saveRDS(x, file = "y.rds")
>>> and
>>> x <- readRDS(file = "y.rds")
>>> will work.
>>>
>>> An undocumented feature?
>>>
>>> Thanks to all who contributed.
>>
>> --
>> Peter Dalgaard, Professor,
>> Center for Statistics, Copenhagen Business School
>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>> Phone: (+45)38153501
>> Office: A 4.23
>> Email: [hidden email]  Priv: [hidden email]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help [2]
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html [3]
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> Links:
> ------
> [1] http://tibco.com
> [2] https://stat.ethz.ch/mailman/listinfo/r-help
> [3] http://www.R-project.org/posting-guide.html

______________________________________________
[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: saveRDS() and readRDS() Why? [solved, pretty much anyway)

R help mailing list-2
It seems like copying the files corrupted them. How did you copy them (with
R
or cp or copy or ftp, etc.)?  I don't see how this has anything to do with
R.

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Mon, Nov 12, 2018 at 7:10 PM, p_connolly <[hidden email]>
wrote:

> On 2018-11-13 12:55, William Dunlap wrote:
>
>> You wrote:
>>   ## On Windows 3.4.2
>>
>> x <- airquality
>>> saveRDS(x, file = "x.rds")
>>> saveRDS(x, file = "y.rds")
>>>
>>
>>   Files x.rds and y.rds are identical in size but utterly different in
>> content.
>>
>>  Wow!  Can you show us the results of
>>   x <- datasets::airquality
>>   saveRDS(x, file="x.rds")
>>   saveRDS(x, file="y.rds")
>>   tools::md5sum(c("x.rds", "y.rds"))
>>   dput(readBin("x.rds", what="raw", n=file.size("x.rds")))
>>   dput(readBin("y.rds", what="raw", n=file.size("y.rds")))
>>
>> (Copy and paste, as text, from the R session, so we can see the input
>> and the output in context.
>>
>
> If I do that on Linux or Windows, I get identical files.
>
> If I copy x.rds and y.rds from Windows to Linux (which is what I wish to
> be able to do) using a shared folder between the Windows VirtualBox host to
> the Linux guest, I  get this:
>
>
> x <- readRDS(file =  "x.rds")
>>
> Error in readRDS(file = "x.rds") : error reading from connection
>
>> x <- readRDS(file =  "y.rds")
>>   tools::md5sum(c("x.rds", "y.rds"))
>>
>                              x.rds                              y.rds
> "5fef054848f39b4be02b7c54f1c71a20" "978a64d1dd342d16a381c9ca728d3665"
>
>>   dput(readBin("x.rds", what="raw", n=file.size("x.rds")))
>>
> as.raw(c(0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00))
>
>>   dput(readBin("y.rds", what="raw", n=file.size("y.rds")))
>>
> as.raw(c(0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x06, 0xe5, 0x97, 0x4b, 0x6c, 0x54, 0x55, 0x18, 0xc7, 0xcf, 0x9d,
> 0x0e, 0x7d, 0x41,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, 0x1f, 0xe7, 0x59, 0x67, 0x67, 0x40, 0xfb,
> 0x66, 0xd4, 0x1e, 0x50, 0x5d, 0x6c, 0xac, 0x7d, 0x83, 0xd9, 0x37,
> 0xe5, 0x2a, 0xce, 0xb3, 0x33, 0xde, 0x5d, 0xce, 0x7f, 0x83, 0xd8,
> 0x99, 0xd5, 0xbe, 0x11, 0xec, 0xdc, 0x6b, 0x67, 0x42, 0xfb, 0x6e,
> 0xb1, 0xef, 0x24, 0xfb, 0x2e, 0xb1, 0xf3, 0xa4, 0x7d, 0x1b, 0xdc,
> 0xe7, 0xfc, 0x59, 0xd2, 0xce, 0xf0, 0x76, 0x96, 0xb6, 0x6f, 0xd5,
> 0x8d, 0x15, 0xf4, 0xfd, 0x7f, 0xcc, 0xb9, 0x82, 0xbe, 0xd3, 0xa9,
> 0xd8, 0x77, 0x3a, 0xb6, 0xbf, 0xa2, 0x5c, 0x3a, 0x37, 0x35, 0x47,
> 0x83, 0xd5, 0x52, 0x1e, 0xbe, 0x38, 0x53, 0x9e, 0x62, 0xa3, 0xa6,
> 0x38, 0x33, 0x5d, 0x9a, 0xed, 0x3c, 0xc2, 0x66, 0x7a, 0xec, 0xd9,
> 0xf2, 0x19, 0xdd, 0x8f, 0x4e, 0x9d, 0x3b, 0xaf, 0x39, 0x43, 0x33,
> 0xe5, 0x0b, 0xcf, 0xb0, 0x51, 0xd5, 0x57, 0x7a, 0x31, 0x74, 0x74,
> 0x7a, 0xba, 0x34, 0x27, 0x47, 0x52, 0xd6, 0x9f, 0x29, 0x5d, 0x28,
> 0x75, 0x9e, 0x9d, 0x45, 0x0c, 0xc1, 0xf0, 0xba, 0xd9, 0x99, 0xe7,
> 0x3b, 0x15, 0x9b, 0x25, 0x9e, 0xba, 0x84, 0x9f, 0x85, 0x85, 0x85,
> 0xa7, 0x21, 0x6e, 0xff, 0x07, 0x03, 0xf3, 0xcf, 0x7e, 0xc7, 0x11,
> 0x00, 0x00))
>
>>
>>
> The issue is evidently with the shared folder. I've been doing that
> (sharing the folder) for years and never encountered a problem.
>
>
>
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com [1]
>>
>> On Mon, Nov 12, 2018 at 12:42 PM, p_connolly
>> <[hidden email]> wrote:
>>
>> On 2018-11-12 22:49, peter dalgaard wrote:
>>> Er, where, what, how? I can't reproduce that, at least not on 3.5.1
>>> on MacOS:
>>>
>>> x <- airquality
>>> saveRDS(x, file = "x.rds")
>>> x <- NULL
>>> x <- readRDS(file = "x.rds")
>>> x
>>> Ozone Solar.R Wind Temp Month Day
>>> 1      41     190  7.4   67     5   1
>>> 2      36     118  8.0   72     5   2
>>> 3      12     149 12.6   74     5   3
>>> ...
>>>
>>> Looks fine to me.
>>>
>>
>> It seems to work fine using the same installation to read as used for
>> the save.
>> But it's a different story if the save was done on a Windows
>> installation and read on a Linux installation.
>>
>> ## On Windows 3.4.2
>>
>> x <- airquality
>>> saveRDS(x, file = "x.rds")
>>> saveRDS(x, file = "y.rds")
>>>
>>
>> Files x.rds and y.rds are identical in size but utterly different in
>> content.
>>
>> ## On Linux 3.5.1
>>
>> x <- readRDS(file =  "x.rds")
>>>
>>  Error in readRDS(file = "x.rds") : error reading from connection
>>
>> x <- readRDS(file =  "y.rds")
>>> head(x)
>>>
>>    Ozone Solar.R Wind Temp Month Day
>> 1    41     190  7.4   67     5   1
>> 2    36     118  8.0   72     5   2
>> 3    12     149 12.6   74     5   3
>> 4    18     313 11.5   62     5   4
>> 5    NA      NA 14.3   56     5   5
>> 6    28      NA 14.9   66     5   6
>>
>> It might just be the age of the Windows installation.  I don't have
>> much use for Windows, so I haven't had much inclination to install a
>> newer version.
>>
>> YMMV
>>
>> ?
>>> -pd
>>>
>>> On 12 Nov 2018, at 08:28 , Patrick Connolly
>>>> <[hidden email]> wrote:
>>>>
>>>> The solution was very simple.  Don't use the same name for the rds
>>>> file  as used for the R object, viz a vie:
>>>>
>>>> saveRDS(x, file = "x.rds")
>>>> and
>>>> x <- readRDS(file = "x.rds")
>>>>
>>>> will not work; however
>>>>
>>>> saveRDS(x, file = "y.rds")
>>>> and
>>>> x <- readRDS(file = "y.rds")
>>>> will work.
>>>>
>>>> An undocumented feature?
>>>>
>>>> Thanks to all who contributed.
>>>>
>>>
>>> --
>>> Peter Dalgaard, Professor,
>>> Center for Statistics, Copenhagen Business School
>>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>>> Phone: (+45)38153501
>>> Office: A 4.23
>>> Email: [hidden email]  Priv: [hidden email]
>>>
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help [2]
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html [3]
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>
>> Links:
>> ------
>> [1] http://tibco.com
>> [2] https://stat.ethz.ch/mailman/listinfo/r-help
>> [3] http://www.R-project.org/posting-guide.html
>>
>

        [[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: saveRDS() and readRDS() Why? [solved, pretty much anyway)

Patrick Connolly-4
This is getting more strange.

I normally copy from the shared folder to the appropriate directory
using Dolphin, the KDE file manager.  If instead I use the standard bash
cp command, no corruption happens -- at least with the limited testing I
have done.  There also seems to be no problem copying from Linux to
Windows.  I installed R-3.5.1 for Windows just to eliminate that
possible issue.

However, R has *something* to do with it because it was used to make the
.rds file.  Just how the relationship between the name of the R object
and the name of the .rds file comes into it, I can't imagine.

Thanks for the suggestion William.


On 2018-11-14 06:26, William Dunlap wrote:

> It seems like copying the files corrupted them. How did you copy them
> (with R
> or cp or copy or ftp, etc.)?  I don't see how this has anything to do
> with R.
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com [1]
> On Mon, Nov 12, 2018 at 7:10 PM, p_connolly
> <[hidden email]> wrote:
[...]

______________________________________________
[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: saveRDS() and readRDS() Why? [solved, pretty much anyway)

R help mailing list-2
Perhaps you got bitten by Dolphin's non-modal dialogs, as described in
https://userbase.kde.org/Dolphin/File_Management:

Non Modal Dialogs

When Moving, Copying or Deleting files/directories the dialog disappears
even when the operation has not yet completed. A progress bar then appears
in the bottom right of the screen, this then disappears also, if you want
see the progress you need to click a small (i) information icon in the
system tray.


Warning
New users who are not used to this way of working (and even experienced
users) can get caught out by this, if you are Moving, Copying or Deleting
large directories then you need to use the icon to monitor the progress of
your operation. If you don't then any subsequent actions you do, may well
use an incomplete file structure resulting in corrupted files. You have
been warned!

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Tue, Nov 13, 2018 at 2:10 PM, p_connolly <[hidden email]>
wrote:

> This is getting more strange.
>
> I normally copy from the shared folder to the appropriate directory using
> Dolphin, the KDE file manager.  If instead I use the standard bash cp
> command, no corruption happens -- at least with the limited testing I have
> done.  There also seems to be no problem copying from Linux to Windows.  I
> installed R-3.5.1 for Windows just to eliminate that possible issue.
>
> However, R has *something* to do with it because it was used to make the
> .rds file.  Just how the relationship between the name of the R object and
> the name of the .rds file comes into it, I can't imagine.
>
> Thanks for the suggestion William.
>
>
> On 2018-11-14 06:26, William Dunlap wrote:
>
>> It seems like copying the files corrupted them. How did you copy them
>> (with R
>> or cp or copy or ftp, etc.)?  I don't see how this has anything to do
>> with R.
>>
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com [1]
>> On Mon, Nov 12, 2018 at 7:10 PM, p_connolly
>> <[hidden email]> wrote:
>>
> [...]
>
>

        [[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.
12