Paul Gilbert | 2 Mar 2009 23:00
Picon

[Rd] S4 data dump or?

I am trying to dump some data in a file that I will add to a package.  
The data has an attribute which is a S4 object, and this seems to cause 
problems.   What is the preferred way to write a file with a dataset 
that has some S4 parts, so that it can be included in a package?

Paul Gilbert
====================================================================================

La version française suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential in...{{dropped:26}}

______________________________________________
R-devel <at> r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Prof Brian Ripley | 3 Mar 2009 08:27
Picon
Picon
Favicon

Re: [Rd] S4 data dump or?

On Mon, 2 Mar 2009, Paul Gilbert wrote:

> I am trying to dump some data in a file that I will add to a package.  The 
> data has an attribute which is a S4 object, and this seems to cause problems. 
> What is the preferred way to write a file with a dataset that has some S4 
> parts, so that it can be included in a package?

Using save() seems almost always preferable to dump(): usually a 
smaller result, avoids representation error changes for numeric types 
and encoding issues for some character vectors, works for almost all 
objects.

I am guessing that the note on ?dump about objects of type S4 is the 
issue here.

> Paul Gilbert

--

-- 
Brian D. Ripley,                  ripley <at> stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel <at> r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Paul Gilbert | 3 Mar 2009 17:59
Picon

Re: [Rd] S4 data dump or?


Prof Brian Ripley wrote:
> On Mon, 2 Mar 2009, Paul Gilbert wrote:
> 
>> I am trying to dump some data in a file that I will add to a package.  
>> The data has an attribute which is a S4 object, and this seems to 
>> cause problems. What is the preferred way to write a file with a 
>> dataset that has some S4 parts, so that it can be included in a package?
> 
> 
> Using save() seems almost always preferable to dump(): usually a smaller 
> result, avoids representation error changes for numeric types and 
> encoding issues for some character vectors, works for almost all objects.

Ok.  I thought I was having a problem with save()/load() too, but it 
seems that problem was something else. I have this working now.
> 
> I am guessing that the note on ?dump about objects of type S4 is the 
> issue here.

Yes, the S4 object causes source() of the dump()ed file to fail.

Thanks,
Paul
> 
>> Paul Gilbert
> 
> 
====================================================================================

(Continue reading)


Gmane