Redefining reference class makes persistent object partly unreadable

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

Redefining reference class makes persistent object partly unreadable

Ross Boylan
A bunch of .rdata is on the disk, created from reference classes (as in
setRefClass()).  I redefined some of the classes--not by much.  Now when
I read in the rdata it seems to have been damaged, because some parts
have "disappeared".  The data are generally a graph of objects, some of
which (e.g., lists) are conventional rather than reference classes.

The specific  part that I noticed disappearing was actually a list
element.

The redefinition seemed quite minimal: no slots changed and the number
of methods did not change.  In some cases the name changed (from show to
summary) along with the definition, in other cases just the definition
of the function changed.

I've verified the crucial role of the code change by flipping between
different versions of the code.  R 3.0.3 on Debian GNU/Linux.

Context: I implemented a bunch of show reference class methods to
display my results.  Now I want to display them in other forms, and so
am trying to shift to returning a summary object.

Thanks.
Ross Boylan

______________________________________________
[hidden email] mailing list
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: Redefining reference class makes persistent object partly unreadable

Jeff Newmiller
This doesn't surprise me, but then I am not a fan of reference classes.

The obvious (to me) answer is to read the objects with the old code and convert them to the new format on the fly or save the data in a more neutral format like csv or json for later use.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<[hidden email]>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.

On July 25, 2014 5:11:17 PM PDT, Ross Boylan <[hidden email]> wrote:

>A bunch of .rdata is on the disk, created from reference classes (as in
>setRefClass()).  I redefined some of the classes--not by much.  Now
>when
>I read in the rdata it seems to have been damaged, because some parts
>have "disappeared".  The data are generally a graph of objects, some of
>which (e.g., lists) are conventional rather than reference classes.
>
>The specific  part that I noticed disappearing was actually a list
>element.
>
>The redefinition seemed quite minimal: no slots changed and the number
>of methods did not change.  In some cases the name changed (from show
>to
>summary) along with the definition, in other cases just the definition
>of the function changed.
>
>I've verified the crucial role of the code change by flipping between
>different versions of the code.  R 3.0.3 on Debian GNU/Linux.
>
>Context: I implemented a bunch of show reference class methods to
>display my results.  Now I want to display them in other forms, and so
>am trying to shift to returning a summary object.
>
>Thanks.
>Ross Boylan
>
>______________________________________________
>[hidden email] mailing list
>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
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.